Liking cljdoc? Tell your friends :D

cljgrapht.algo

Graph algorithms over cljgrapht.core graphs. Every function takes a graph and returns plain Clojure data (paths as vectors, components as sets, scores as maps), so results compose with the rest of your Clojure code.

Direction matters: connected-components is for undirected graphs; strongly-connected-components, topological-sort, and cycle? are for directed graphs.

Graph algorithms over `cljgrapht.core` graphs. Every function takes a graph
and returns plain Clojure data (paths as vectors, components as sets, scores as
maps), so results compose with the rest of your Clojure code.

Direction matters: `connected-components` is for undirected graphs;
`strongly-connected-components`, `topological-sort`, and `cycle?` are for
directed graphs.
raw docstring

all-pairs-shortest-path-lengthclj

(all-pairs-shortest-path-length g)

Nested map {u {v weight}} of cheapest path weights between every reachable ordered pair of distinct vertices (Floyd-Warshall).

Nested map {u {v weight}} of cheapest path weights between every reachable
ordered pair of distinct vertices (Floyd-Warshall).
sourceraw docstring

betweenness-centralityclj

(betweenness-centrality g)

Map of vertex -> betweenness centrality score.

Map of vertex -> betweenness centrality score.
sourceraw docstring

closeness-centralityclj

(closeness-centrality g)

Map of vertex -> closeness centrality score.

Map of vertex -> closeness centrality score.
sourceraw docstring

connected-componentsclj

(connected-components g)

Seq of vertex sets, one per connected component (undirected; for a directed graph these are the weakly-connected components).

Seq of vertex sets, one per connected component (undirected; for a directed
graph these are the weakly-connected components).
sourceraw docstring

cycle?clj

(cycle? g)

True if the directed graph g contains a cycle.

True if the directed graph `g` contains a cycle.
sourceraw docstring

minimum-spanning-treeclj

(minimum-spanning-tree g)

Minimum spanning tree of weighted graph g as {:edges #{[u v] ...} :weight w} (Prim).

Minimum spanning tree of weighted graph `g` as
`{:edges #{[u v] ...} :weight w}` (Prim).
sourceraw docstring

pagerankclj

(pagerank g)

Map of vertex -> PageRank score.

Map of vertex -> PageRank score.
sourceraw docstring

shortest-pathclj

(shortest-path g src dst)

Cheapest path from src to dst as {:path [v ...] :weight w}, or nil if unreachable. Uses Dijkstra; unweighted graphs use unit edge weights, so :weight is the hop count.

Cheapest path from `src` to `dst` as `{:path [v ...] :weight w}`, or nil if
unreachable. Uses Dijkstra; unweighted graphs use unit edge weights, so
`:weight` is the hop count.
sourceraw docstring

shortest-path-lengthclj

(shortest-path-length g src dst)

Weight of the cheapest src->dst path, or nil if unreachable.

Weight of the cheapest `src`->`dst` path, or nil if unreachable.
sourceraw docstring

strongly-connected-componentsclj

(strongly-connected-components g)

Seq of vertex sets, one per strongly-connected component (directed).

Seq of vertex sets, one per strongly-connected component (directed).
sourceraw docstring

topological-sortclj

(topological-sort g)

Vector of vertices of directed acyclic graph g in topological order, or nil if g contains a cycle.

Vector of vertices of directed acyclic graph `g` in topological order, or nil
if `g` contains a cycle.
sourceraw docstring

vertices-on-cyclesclj

(vertices-on-cycles g)

Set of vertices that participate in at least one cycle of directed graph g.

Set of vertices that participate in at least one cycle of directed graph `g`.
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