Liking cljdoc? Tell your friends :D

cljgrapht.core

Idiomatic construction and inspection of graphs backed by JGraphT.

Vertices are arbitrary Clojure values (keywords, strings, numbers, maps). Graphs are JGraphT's native mutable objects: constructors and mutators return the same graph for threading, but they mutate in place (this is a performance wrapper, not a persistent data structure). Algorithms live in cljgrapht.algo and return plain Clojure data.

Idiomatic construction and inspection of graphs backed by JGraphT.

Vertices are arbitrary Clojure values (keywords, strings, numbers, maps).
Graphs are JGraphT's native mutable objects: constructors and mutators return
the same graph for threading, but they mutate in place (this is a performance
wrapper, not a persistent data structure). Algorithms live in `cljgrapht.algo`
and return plain Clojure data.
raw docstring

add-edgeclj

(add-edge g u v)
(add-edge g u v w)

Add an edge u -> v (optionally with weight w) to g, adding the vertices if absent. Returns g.

Add an edge `u -> v` (optionally with weight `w`) to `g`, adding the vertices
if absent. Returns `g`.
sourceraw docstring

add-vertexclj

(add-vertex g v)

Add vertex v to g, returning g.

Add vertex `v` to `g`, returning `g`.
sourceraw docstring

all-edgesclj

(all-edges g u v)

The set of edge objects from u to v in g.

The set of edge objects from `u` to `v` in `g`.
sourceraw docstring

contains-edge?clj

(contains-edge? g u v)

Whether g contains an edge from u to v.

Whether `g` contains an edge from `u` to `v`.
sourceraw docstring

contains-vertex?clj

(contains-vertex? g v)

Whether g contains vertex v.

Whether `g` contains vertex `v`.
sourceraw docstring

degreeclj

(degree g v)

The degree of vertex v in g.

The degree of vertex `v` in `g`.
sourceraw docstring

digraphclj

(digraph)
(digraph edges)

A directed graph. Optional edges is a seq of [u v] pairs.

A directed graph. Optional `edges` is a seq of [u v] pairs.
sourceraw docstring

directed?clj

(directed? g)

Whether g is directed.

Whether `g` is directed.
sourceraw docstring

edge-reversed-viewclj

(edge-reversed-view g)

A view of directed graph g with all edge directions reversed.

A view of directed graph `g` with all edge directions reversed.
sourceraw docstring

edge-sourceclj

(edge-source g edge)

The source vertex of edge in g.

The source vertex of `edge` in `g`.
sourceraw docstring

edge-targetclj

(edge-target g edge)

The target vertex of edge in g.

The target vertex of `edge` in `g`.
sourceraw docstring

edgesclj

(edges g)

A seq of edges in g: [u v] pairs, or [u v w] triples when g is weighted.

A seq of edges in `g`: [u v] pairs, or [u v w] triples when `g` is weighted.
sourceraw docstring

endpointsclj

(endpoints g edge)

The [source target] endpoints of edge in g.

The [source target] endpoints of `edge` in `g`.
sourceraw docstring

get-edgeclj

(get-edge g u v)

The edge object from u to v in g, or nil.

The edge object from `u` to `v` in `g`, or nil.
sourceraw docstring

graphclj

(graph)
(graph edges)

An undirected graph. Optional edges is a seq of [u v] pairs.

An undirected graph. Optional `edges` is a seq of [u v] pairs.
sourceraw docstring

graph-typeclj

(graph-type g)

The JGraphT graph type of g as a Clojure map.

The JGraphT graph type of `g` as a Clojure map.
sourceraw docstring

in-degreeclj

(in-degree g v)

The incoming degree of vertex v in g.

The incoming degree of vertex `v` in `g`.
sourceraw docstring

incident-edgesclj

(incident-edges g v)

A seq of rendered edges incident to vertex v in g.

A seq of rendered edges incident to vertex `v` in `g`.
sourceraw docstring

incoming-edgesclj

(incoming-edges g v)

A seq of rendered edges incoming to vertex v in g.

A seq of rendered edges incoming to vertex `v` in `g`.
sourceraw docstring

make-graphclj

(make-graph opts)

Build a graph from options controlling its type, suppliers, and initial edges.

Build a graph from options controlling its type, suppliers, and initial edges.
sourceraw docstring

neighborsclj

(neighbors g v)

Vertices adjacent to v in g (direction-agnostic).

Vertices adjacent to `v` in `g` (direction-agnostic).
sourceraw docstring

orderclj

(order g)

The number of vertices in g.

The number of vertices in `g`.
sourceraw docstring

out-degreeclj

(out-degree g v)

The outgoing degree of vertex v in g.

The outgoing degree of vertex `v` in `g`.
sourceraw docstring

outgoing-edgesclj

(outgoing-edges g v)

A seq of rendered edges outgoing from vertex v in g.

A seq of rendered edges outgoing from vertex `v` in `g`.
sourceraw docstring

predecessorsclj

(predecessors g v)

Vertices with an edge into v in g.

Vertices with an edge into `v` in `g`.
sourceraw docstring

remove-edgeclj

(remove-edge g edge)
(remove-edge g u v)

Remove an edge from g by endpoints or by edge object, returning g.

Remove an edge from `g` by endpoints or by edge object, returning `g`.
sourceraw docstring

remove-vertexclj

(remove-vertex g v)

Remove vertex v and its incident edges from g, returning g.

Remove vertex `v` and its incident edges from `g`, returning `g`.
sourceraw docstring

set-weightclj

(set-weight g u v w)

Set the weight of edge u -> v to w, returning g.

Set the weight of edge `u -> v` to `w`, returning `g`.
sourceraw docstring

sizeclj

(size g)

The number of edges in g.

The number of edges in `g`.
sourceraw docstring

subgraphclj

(subgraph g vertex-subset)
(subgraph g vertex-subset edge-subset)

A view of g over a vertex subset and optional edge-object subset.

A view of `g` over a vertex subset and optional edge-object subset.
sourceraw docstring

successorsclj

(successors g v)

Vertices reachable from v by an outgoing edge in g.

Vertices reachable from `v` by an outgoing edge in `g`.
sourceraw docstring

undirected-viewclj

(undirected-view g)

An undirected view of directed graph g.

An undirected view of directed graph `g`.
sourceraw docstring

unmodifiable-viewclj

(unmodifiable-view g)

An unmodifiable view of g.

An unmodifiable view of `g`.
sourceraw docstring

unweighted-viewclj

(unweighted-view g)

An unweighted view of g.

An unweighted view of `g`.
sourceraw docstring

verticesclj

(vertices g)

The set of vertices in g.

The set of vertices in `g`.
sourceraw docstring

weightclj

(weight g u v)

The weight of the edge u -> v in g.

The weight of the edge `u -> v` in `g`.
sourceraw docstring

weighted-digraphclj

(weighted-digraph)
(weighted-digraph edges)

A directed weighted graph. Optional edges is a seq of [u v w] triples.

A directed weighted graph. Optional `edges` is a seq of [u v w] triples.
sourceraw docstring

weighted-graphclj

(weighted-graph)
(weighted-graph edges)

An undirected weighted graph. Optional edges is a seq of [u v w] triples.

An undirected weighted graph. Optional `edges` is a seq of [u v w] triples.
sourceraw docstring

weighted-viewclj

(weighted-view g weights)

A weighted view of g using a map from edge objects to weights.

A weighted view of `g` using a map from edge objects to weights.
sourceraw docstring

weighted?clj

(weighted? g)

Whether g supports edge weights.

Whether `g` supports edge weights.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close