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.
(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`.
(add-vertex g v)Add vertex v to g, returning g.
Add vertex `v` to `g`, returning `g`.
(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`.
(contains-edge? g u v)Whether g contains an edge from u to v.
Whether `g` contains an edge from `u` to `v`.
(contains-vertex? g v)Whether g contains vertex v.
Whether `g` contains vertex `v`.
(degree g v)The degree of vertex v in g.
The degree of vertex `v` in `g`.
(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.
(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.
(edge-source g edge)The source vertex of edge in g.
The source vertex of `edge` in `g`.
(edge-target g edge)The target vertex of edge in g.
The target vertex of `edge` in `g`.
(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.
(endpoints g edge)The [source target] endpoints of edge in g.
The [source target] endpoints of `edge` in `g`.
(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.
(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.
(graph-type g)The JGraphT graph type of g as a Clojure map.
The JGraphT graph type of `g` as a Clojure map.
(in-degree g v)The incoming degree of vertex v in g.
The incoming degree of vertex `v` in `g`.
(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`.
(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`.
(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.
(neighbors g v)Vertices adjacent to v in g (direction-agnostic).
Vertices adjacent to `v` in `g` (direction-agnostic).
(out-degree g v)The outgoing degree of vertex v in g.
The outgoing degree of vertex `v` in `g`.
(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`.
(predecessors g v)Vertices with an edge into v in g.
Vertices with an edge into `v` in `g`.
(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`.
(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`.
(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`.
(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.
(successors g v)Vertices reachable from v by an outgoing edge in g.
Vertices reachable from `v` by an outgoing edge in `g`.
(undirected-view g)An undirected view of directed graph g.
An undirected view of directed graph `g`.
(unmodifiable-view g)An unmodifiable view of g.
An unmodifiable view of `g`.
(unweighted-view g)An unweighted view of g.
An unweighted view of `g`.
(weight g u v)The weight of the edge u -> v in g.
The weight of the edge `u -> v` in `g`.
(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.
(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.
(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.
(weighted? g)Whether g supports edge weights.
Whether `g` supports edge weights.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |