Liking cljdoc? Tell your friends :D
Clojure only.

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-directed-pathsclj

(all-directed-paths g src dst)
(all-directed-paths g src dst {:keys [simple? max-length] :or {simple? true}})

All directed paths from src to dst. Options are :simple? (default true) and :max-length, the maximum number of edges.

All directed paths from `src` to `dst`. Options are `:simple?` (default true)
and `:max-length`, the maximum number of edges.
sourceraw 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

all-simple-pathsclj

(all-simple-paths g src dst)

All simple directed paths from src to dst, as vectors of {:path [v ...] :weight w} maps.

All simple directed paths from `src` to `dst`, as vectors of
`{:path [v ...] :weight w}` maps.
sourceraw docstring

alpha-centralityclj

(alpha-centrality g)
(alpha-centrality g alpha)

Map of vertex -> alpha-attenuated (Katz) centrality score. alpha defaults to JGraphT's damping factor.

Map of vertex -> alpha-attenuated (Katz) centrality score. `alpha` defaults
to JGraphT's damping factor.
sourceraw docstring

articulation-pointsclj

(articulation-points g)

Set of articulation vertices in an undirected graph.

Set of articulation vertices in an undirected graph.
sourceraw docstring

assignmentclj

(assignment g part1 part2)

Minimum-weight perfect bipartite matching between part1 and part2.

Minimum-weight perfect bipartite matching between `part1` and `part2`.
sourceraw docstring

astarclj

(astar g src dst heuristic)

Cheapest path from src to dst as {:path [v ...] :weight w}, or nil if unreachable, using A* with heuristic, a function of [vertex target].

Cheapest path from `src` to `dst` as `{:path [v ...] :weight w}`, or nil if
unreachable, using A* with `heuristic`, a function of `[vertex target]`.
sourceraw docstring

bar-yehuda-even-two-approx-vertex-coverclj

(bar-yehuda-even-two-approx-vertex-cover g)
(bar-yehuda-even-two-approx-vertex-cover g weights)

Bar-Yehuda-Even 2-approximation vertex cover, optionally weighted.

Bar-Yehuda-Even 2-approximation vertex cover, optionally weighted.
sourceraw docstring

bellman-fordclj

(bellman-ford g src dst)

Cheapest path from src to dst as {:path [v ...] :weight w}, or nil if unreachable. Supports negative edge weights but not negative cycles.

Cheapest path from `src` to `dst` as `{:path [v ...] :weight w}`, or nil if
unreachable. Supports negative edge weights but not negative cycles.
sourceraw docstring

bellman-ford-distancesclj

(bellman-ford-distances g src)

Map of every reachable vertex from src to its Bellman-Ford distance. Includes src with distance 0.0.

Map of every reachable vertex from `src` to its Bellman-Ford distance.
Includes `src` with distance 0.0.
sourceraw docstring

betweenness-centralityclj

(betweenness-centrality g)

Map of vertex -> betweenness centrality score.

Map of vertex -> betweenness centrality score.
sourceraw docstring

bfsclj

(bfs g start)

Vector of vertices in breadth-first order from start.

Vector of vertices in breadth-first order from `start`.
sourceraw docstring

biconnected-componentsclj

(biconnected-components g)

Seq of vertex sets, one per maximal biconnected block.

Seq of vertex sets, one per maximal biconnected block.
sourceraw docstring

bidirectional-shortest-pathclj

(bidirectional-shortest-path g src dst)

Cheapest path from src to dst using bidirectional Dijkstra.

Cheapest path from `src` to `dst` using bidirectional Dijkstra.
sourceraw docstring

bipartite-matchingclj

(bipartite-matching g part1 part2)

Maximum cardinality matching of bipartite graph g with vertex partitions part1 and part2, as {:edges #{[u v] ...} :size n} (Hopcroft-Karp).

Maximum cardinality matching of bipartite graph `g` with vertex partitions
`part1` and `part2`, as `{:edges #{[u v] ...} :size n}` (Hopcroft-Karp).
sourceraw docstring

bipartite-setsclj

(bipartite-sets g)

Two vertex partition sets when g is bipartite, otherwise nil.

Two vertex partition sets when `g` is bipartite, otherwise nil.
sourceraw docstring

bipartite?clj

(bipartite? g)

True if g is bipartite.

True if `g` is bipartite.
sourceraw docstring

block-cut-treeclj

(block-cut-tree g)

Block-cut tree as block sets, articulation vertices, and [block cutpoint] edges.

Block-cut tree as block sets, articulation vertices, and `[block cutpoint]`
edges.
sourceraw docstring

blocksclj

(blocks g)

Seq of vertex sets, one per block of an undirected graph.

Seq of vertex sets, one per block of an undirected graph.
sourceraw docstring

boruvka-minimum-spanning-treeclj

(boruvka-minimum-spanning-tree g)

Minimum spanning tree using Boruvka's algorithm.

Minimum spanning tree using Boruvka's algorithm.
sourceraw docstring

bridgesclj

(bridges g)

Set of bridge edges as [source target] pairs in an undirected graph.

Set of bridge edges as `[source target]` pairs in an undirected graph.
sourceraw docstring

bron-kerbosch-maximal-cliquesclj

(bron-kerbosch-maximal-cliques g)

Seq of maximal cliques using the basic Bron-Kerbosch algorithm.

Seq of maximal cliques using the basic Bron-Kerbosch algorithm.
sourceraw docstring

capacitated-spanning-treeclj

(capacitated-spanning-tree g root capacity demands)

Esau-Williams capacitated spanning tree rooted at root. demands maps vertices to nonnegative demand values.

Esau-Williams capacitated spanning tree rooted at `root`. `demands` maps
vertices to nonnegative demand values.
sourceraw docstring

chinese-postmanclj

(chinese-postman g)

Minimum closed walk covering every edge as {:path [v ...] :weight w}.

Minimum closed walk covering every edge as `{:path [v ...] :weight w}`.
sourceraw docstring

chordal-coloringclj

(chordal-coloring g)

Optimal coloring of a chordal graph.

Optimal coloring of a chordal graph.
sourceraw docstring

chordal-maximum-cliqueclj

(chordal-maximum-clique g)

Maximum clique as a vertex set, or nil when the graph is non-chordal.

Maximum clique as a vertex set, or nil when the graph is non-chordal.
sourceraw docstring

chordal-maximum-independent-setclj

(chordal-maximum-independent-set g)

Maximum independent vertex set of a chordal graph.

Maximum independent vertex set of a chordal graph.
sourceraw docstring

chordal-minimum-vertex-coverclj

(chordal-minimum-vertex-cover g)

Minimum vertex cover of a chordal graph, derived as the complement of a maximum independent set.

Minimum vertex cover of a chordal graph, derived as the complement of a
maximum independent set.
sourceraw docstring

chordal?clj

(chordal? g)

True if the undirected graph is chordal.

True if the undirected graph is chordal.
sourceraw docstring

clarkson-two-approx-vertex-coverclj

(clarkson-two-approx-vertex-cover g)
(clarkson-two-approx-vertex-cover g weights)

Clarkson 2-approximation vertex cover, optionally weighted.

Clarkson 2-approximation vertex cover, optionally weighted.
sourceraw docstring

closeness-centralityclj

(closeness-centrality g)

Map of vertex -> closeness centrality score.

Map of vertex -> closeness centrality score.
sourceraw docstring

clusteringclj

(clustering g)
(clustering g {:keys [method k] :or {method :label-propagation}})

Partition vertices into clusters. Methods are :label-propagation (default), :girvan-newman, and :k-spanning-tree; the latter two require :k.

Partition vertices into clusters. Methods are `:label-propagation` (default),
`:girvan-newman`, and `:k-spanning-tree`; the latter two require `:k`.
sourceraw docstring

clustering-coefficientclj

(clustering-coefficient g)

Map of vertex -> local clustering coefficient.

Map of vertex -> local clustering coefficient.
sourceraw docstring

color-refinementclj

(color-refinement g)

Stable equitable vertex coloring produced by color refinement.

Stable equitable vertex coloring produced by color refinement.
sourceraw docstring

color-refinement-isomorphic?clj

(color-refinement-isomorphic? g1 g2)

True when color refinement proves g1 and g2 isomorphic.

True when color refinement proves `g1` and `g2` isomorphic.
sourceraw docstring

coloringclj

(coloring g)
(coloring g {:keys [algorithm] :or {algorithm :saturation}})

Vertex coloring of g as {:colors {vertex color-int, ...} :chromatic n}. Options may include :algorithm, one of :saturation (default), :greedy, :largest-degree-first, or :smallest-degree-last.

Vertex coloring of `g` as `{:colors {vertex color-int, ...} :chromatic n}`.
Options may include `:algorithm`, one of `:saturation` (default), `:greedy`,
`:largest-degree-first`, or `:smallest-degree-last`.
sourceraw docstring

common-neighbors-scoreclj

(common-neighbors-score g u v)
source

condensationclj

(condensation g)

Condensation DAG of a directed graph as SCC vertex sets and edges between those sets.

Condensation DAG of a directed graph as SCC vertex sets and edges between
those sets.
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

connected?clj

(connected? g)

True if g is connected. Directed graphs are checked as weakly connected.

True if `g` is connected. Directed graphs are checked as weakly connected.
sourceraw docstring

contraction-hierarchy-shortest-pathclj

(contraction-hierarchy-shortest-path g src dst)

Cheapest path from src to dst using a contraction hierarchy.

Cheapest path from `src` to `dst` using a contraction hierarchy.
sourceraw docstring

corenessclj

(coreness g)

Map of vertex -> core number.

Map of vertex -> core number.
sourceraw docstring

cycle-basisclj

(cycle-basis g)

Paton cycle basis as {:cycles [[v ...] ...] :length n :weight w}.

Paton cycle basis as `{:cycles [[v ...] ...] :length n :weight w}`.
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

dag?clj

(dag? g)

True if directed graph g is acyclic.

True if directed graph `g` is acyclic.
sourceraw docstring

degeneracy-maximal-cliquesclj

(degeneracy-maximal-cliques g)

Seq of maximal cliques using degeneracy-ordered Bron-Kerbosch.

Seq of maximal cliques using degeneracy-ordered Bron-Kerbosch.
sourceraw docstring

delta-stepping-shortest-pathclj

(delta-stepping-shortest-path g src dst)

Cheapest path from src to dst using parallel delta-stepping.

Cheapest path from `src` to `dst` using parallel delta-stepping.
sourceraw docstring

dense-edmonds-maximum-matchingclj

(dense-edmonds-maximum-matching g)

Maximum-cardinality matching using the dense Edmonds implementation.

Maximum-cardinality matching using the dense Edmonds implementation.
sourceraw docstring

densityclj

(density g)

Graph density as m divided by the number of possible non-loop edges.

Graph density as m divided by the number of possible non-loop edges.
sourceraw docstring

dfsclj

(dfs g start)

Vector of vertices in depth-first pre-order from start. Neighbor visitation follows JGraphT's stack order: most-recently-added first.

Vector of vertices in depth-first pre-order from `start`. Neighbor
visitation follows JGraphT's stack order: most-recently-added first.
sourceraw docstring

diameterclj

(diameter g)

Maximum shortest-path distance between any two vertices.

Maximum shortest-path distance between any two vertices.
sourceraw docstring

dinic-max-flowclj

(dinic-max-flow g source sink)

Maximum flow using Dinic's algorithm.

Maximum flow using Dinic's algorithm.
sourceraw docstring

disjoint-shortest-pathsclj

(disjoint-shortest-paths g src dst k)

Up to k edge-disjoint shortest paths from src to dst using Suurballe.

Up to `k` edge-disjoint shortest paths from `src` to `dst` using Suurballe.
sourceraw docstring

dsatur-coloringclj

(dsatur-coloring g)

Saturation-degree (DSATUR) vertex coloring.

Saturation-degree (DSATUR) vertex coloring.
sourceraw docstring

dulmage-mendelsohnclj

(dulmage-mendelsohn g part1 part2)
(dulmage-mendelsohn g part1 part2 {:keys [fine?] :or {fine? false}})

Dulmage-Mendelsohn decomposition of a bipartite graph. Set :fine? for the fine decomposition of the perfectly matched part.

Dulmage-Mendelsohn decomposition of a bipartite graph. Set `:fine?` for the
fine decomposition of the perfectly matched part.
sourceraw docstring

edge-based-two-approx-vertex-coverclj

(edge-based-two-approx-vertex-cover g)

Edge-based 2-approximation vertex cover.

Edge-based 2-approximation vertex cover.
sourceraw docstring

edmonds-karp-max-flowclj

(edmonds-karp-max-flow g source sink)

Maximum flow using Edmonds-Karp.

Maximum flow using Edmonds-Karp.
sourceraw docstring

eigenvector-centralityclj

(eigenvector-centrality g)

Map of vertex -> eigenvector centrality score.

Map of vertex -> eigenvector centrality score.
sourceraw docstring

eulerian-cycleclj

(eulerian-cycle g)

Eulerian cycle as {:path [v ...] :weight w}, or nil when none exists.

Eulerian cycle as `{:path [v ...] :weight w}`, or nil when none exists.
sourceraw docstring

eulerian?clj

(eulerian? g)

True when g has an Eulerian cycle.

True when `g` has an Eulerian cycle.
sourceraw docstring

gabow-strongly-connected-componentsclj

(gabow-strongly-connected-components g)

Seq of strongly-connected vertex sets using Gabow's algorithm.

Seq of strongly-connected vertex sets using Gabow's algorithm.
sourceraw docstring

girthclj

(girth g)

Length of the shortest cycle in an undirected graph, or nil when acyclic.

Length of the shortest cycle in an undirected graph, or nil when acyclic.
sourceraw docstring

global-clustering-coefficientclj

(global-clustering-coefficient g)

Global clustering coefficient of g.

Global clustering coefficient of `g`.
sourceraw docstring

gomory-hu-treeclj

(gomory-hu-tree g)

Gomory-Hu cut tree as weighted [u v weight] edges.

Gomory-Hu cut tree as weighted `[u v weight]` edges.
sourceraw docstring

graph-centerclj

(graph-center g)

Set of vertices whose eccentricity equals the graph radius.

Set of vertices whose eccentricity equals the graph radius.
sourceraw docstring

graph-peripheryclj

(graph-periphery g)

Set of vertices whose eccentricity equals the graph diameter.

Set of vertices whose eccentricity equals the graph diameter.
sourceraw docstring

greedy-coloringclj

(greedy-coloring g)

Greedy vertex coloring of g as {:colors {vertex color-int, ...} :chromatic n}.

Greedy vertex coloring of `g` as
`{:colors {vertex color-int, ...} :chromatic n}`.
sourceraw docstring

greedy-maximum-matchingclj

(greedy-maximum-matching g)

Greedy maximal cardinality matching.

Greedy maximal cardinality matching.
sourceraw docstring

greedy-vertex-coverclj

(greedy-vertex-cover g)
(greedy-vertex-cover g weights)

Greedy vertex cover, optionally using a vertex-to-weight map.

Greedy vertex cover, optionally using a vertex-to-weight map.
sourceraw docstring

greedy-weighted-matchingclj

(greedy-weighted-matching g)

Greedy approximate maximum-weight matching.

Greedy approximate maximum-weight matching.
sourceraw docstring

harmonic-centralityclj

(harmonic-centrality g)

Map of vertex -> harmonic centrality score.

Map of vertex -> harmonic centrality score.
sourceraw docstring

hopcroft-karp-matchingclj

(hopcroft-karp-matching g part1 part2)

Maximum bipartite matching using Hopcroft-Karp.

Maximum bipartite matching using Hopcroft-Karp.
sourceraw docstring

hub-depressed-indexclj

(hub-depressed-index g u v)
source

hub-promoted-indexclj

(hub-promoted-index g u v)
source

isolated-verticesclj

(isolated-vertices g)

Set of vertices with degree zero.

Set of vertices with degree zero.
sourceraw docstring

isomorphic?clj

(isomorphic? g1 g2)

True if g1 and g2 are graph-isomorphic according to VF2. Rejects mixed directed/undirected graph pairs.

True if `g1` and `g2` are graph-isomorphic according to VF2. Rejects mixed
directed/undirected graph pairs.
sourceraw docstring

jaccard-coefficientclj

(jaccard-coefficient g u v)
source

johnson-all-pairsclj

(johnson-all-pairs g)

Nested map {u {v weight}} of cheapest path weights between every reachable ordered pair of distinct vertices (Johnson). Supports negative edge weights but not negative cycles.

Nested map {u {v weight}} of cheapest path weights between every reachable
ordered pair of distinct vertices (Johnson). Supports negative edge weights
but not negative cycles.
sourceraw docstring

johnson-simple-cyclesclj

(johnson-simple-cycles g)

Simple directed cycles using Johnson's algorithm.

Simple directed cycles using Johnson's algorithm.
sourceraw docstring

k-shortest-pathsclj

(k-shortest-paths g src dst k)

k shortest simple paths from src to dst, as vectors of {:path [v ...] :weight w} maps (Yen).

`k` shortest simple paths from `src` to `dst`, as vectors of
`{:path [v ...] :weight w}` maps (Yen).
sourceraw docstring

kosaraju-strongly-connected-componentsclj

(kosaraju-strongly-connected-components g)

Seq of strongly-connected vertex sets using Kosaraju's algorithm.

Seq of strongly-connected vertex sets using Kosaraju's algorithm.
sourceraw docstring

kruskal-minimum-spanning-treeclj

(kruskal-minimum-spanning-tree g)

Minimum spanning tree using Kruskal's algorithm.

Minimum spanning tree using Kruskal's algorithm.
sourceraw docstring

kuratowski-subdivisionclj

(kuratowski-subdivision g)

Kuratowski subdivision witness as vertex and edge sets; nil if planar.

Kuratowski subdivision witness as vertex and edge sets; nil if planar.
sourceraw docstring

largest-degree-first-coloringclj

(largest-degree-first-coloring g)

Greedy coloring in descending degree order.

Greedy coloring in descending degree order.
sourceraw docstring

lcaclj

(lca g a b)
(lca g a b opts)

Lowest common ancestor, or nil when none exists.

Lowest common ancestor, or nil when none exists.
sourceraw docstring

lca-setclj

(lca-set g a b)
(lca-set g a b opts)

Set of lowest common ancestors, possibly empty.

Set of lowest common ancestors, possibly empty.
sourceraw docstring

line-graphclj

(line-graph g)
(line-graph g weight-fn)

Return the line graph of g. With weight-fn, produce weighted line edges.

Return the line graph of `g`. With `weight-fn`, produce weighted line edges.
sourceraw docstring

(link-prediction-score g
                       u
                       v
                       {:keys [algorithm] :or {algorithm :common-neighbors}})

Predict a link score between u and v.

Predict a link score between `u` and `v`.
sourceraw docstring

max-flowclj

(max-flow g source sink)

Maximum source->sink flow in directed graph g as {:value flow-value :flow {[u v] flow-on-edge, ...}} (Push-Relabel). Edge weights are capacities; zero-flow edges are omitted from :flow.

Maximum `source`->`sink` flow in directed graph `g` as
`{:value flow-value :flow {[u v] flow-on-edge, ...}}` (Push-Relabel). Edge
weights are capacities; zero-flow edges are omitted from `:flow`.
sourceraw docstring

maximal-cliquesclj

(maximal-cliques g)

Seq of maximal cliques of undirected graph g, each as a vertex set (Bron-Kerbosch).

Seq of maximal cliques of undirected graph `g`, each as a vertex set
(Bron-Kerbosch).
sourceraw docstring

maximum-density-subgraphclj

(maximum-density-subgraph g s t)
(maximum-density-subgraph g s t {:keys [epsilon] :or {epsilon 1.0E-9}})

Find a densest subgraph. s and t must be distinct sentinel vertices not in g.

Find a densest subgraph. `s` and `t` must be distinct sentinel vertices not in `g`.
sourceraw docstring

maximum-matchingclj

(maximum-matching g)

Maximum cardinality matching of undirected graph g as {:edges #{[u v] ...} :size n} (Edmonds).

Maximum cardinality matching of undirected graph `g` as
`{:edges #{[u v] ...} :size n}` (Edmonds).
sourceraw docstring

maximum-weight-matchingclj

(maximum-weight-matching g)

Maximum weight matching of undirected graph g as {:edges #{[u v] ...} :weight w} (Kolmogorov blossom).

Maximum weight matching of undirected graph `g` as
`{:edges #{[u v] ...} :weight w}` (Kolmogorov blossom).
sourceraw docstring

min-cost-flowclj

(min-cost-flow g
               {:keys [supplies capacities lower-bounds]
                :or {supplies {} capacities {} lower-bounds {}}})

Minimum-cost flow for integer :supplies and :capacities maps. Edge weights are costs. Optional :lower-bounds defaults to zero.

Minimum-cost flow for integer `:supplies` and `:capacities` maps.
Edge weights are costs. Optional `:lower-bounds` defaults to zero.
sourceraw docstring

min-cutclj

(min-cut g source sink)

Minimum source->sink cut in directed graph g as {:weight w :source-partition #{...} :sink-partition #{...}} (Push-Relabel).

Minimum `source`->`sink` cut in directed graph `g` as
`{:weight w :source-partition #{...} :sink-partition #{...}}` (Push-Relabel).
sourceraw docstring

min-vertex-coverclj

(min-vertex-cover g)
(min-vertex-cover g weights)

Exact minimum vertex cover, optionally using a vertex-to-weight map.

Exact minimum vertex cover, optionally using a vertex-to-weight map.
sourceraw docstring

minimal-weight-perfect-matchingclj

(minimal-weight-perfect-matching g part1 part2)

Alias for assignment.

Alias for `assignment`.
sourceraw docstring

minimum-cutclj

(minimum-cut g)

Global minimum cut of an undirected graph.

Global minimum cut of an undirected graph.
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

minimum-st-cutclj

(minimum-st-cut g source sink)

Minimum source-to-sink cut with source and sink partitions.

Minimum source-to-sink cut with source and sink partitions.
sourceraw docstring

naive-lcaclj

(naive-lca g a b)
source

pagerankclj

(pagerank g)

Map of vertex -> PageRank score.

Map of vertex -> PageRank score.
sourceraw docstring

path-growing-weighted-matchingclj

(path-growing-weighted-matching g)

Approximate maximum-weight matching using path growing.

Approximate maximum-weight matching using path growing.
sourceraw docstring

perfect-elimination-orderclj

(perfect-elimination-order g)

Perfect elimination order for a chordal graph, or nil when non-chordal.

Perfect elimination order for a chordal graph, or nil when non-chordal.
sourceraw docstring

pivot-maximal-cliquesclj

(pivot-maximal-cliques g)

Seq of maximal cliques using pivoting Bron-Kerbosch.

Seq of maximal cliques using pivoting Bron-Kerbosch.
sourceraw docstring

planar-embeddingclj

(planar-embedding g)

Planar rotation system as {vertex [neighbor ...]}; nil if nonplanar.

Planar rotation system as `{vertex [neighbor ...]}`; nil if nonplanar.
sourceraw docstring

planar?clj

(planar? g)

True if the undirected graph is planar.

True if the undirected graph is planar.
sourceraw docstring

(predict-links g pairs)
(predict-links g pairs {:keys [algorithm] :or {algorithm :common-neighbors}})

Predict scores for [u v] pairs as a map.

Predict scores for `[u v]` pairs as a map.
sourceraw docstring

preferential-attachment-scoreclj

(preferential-attachment-score g u v)
source

prim-minimum-spanning-treeclj

(prim-minimum-spanning-tree g)

Minimum spanning tree using Prim's algorithm.

Minimum spanning tree using Prim's algorithm.
sourceraw docstring

pseudo-peripheryclj

(pseudo-periphery g)

Set of vertices whose neighbors have no greater eccentricity.

Set of vertices whose neighbors have no greater eccentricity.
sourceraw docstring

push-relabel-max-flowclj

(push-relabel-max-flow g source sink)

Maximum flow using push-relabel.

Maximum flow using push-relabel.
sourceraw docstring

radiusclj

(radius g)

Minimum vertex eccentricity.

Minimum vertex eccentricity.
sourceraw docstring

random-greedy-coloringclj

(random-greedy-coloring g)

Greedy coloring in randomized vertex order.

Greedy coloring in randomized vertex order.
sourceraw docstring

resource-allocation-indexclj

(resource-allocation-index g u v)
source

salton-indexclj

(salton-index g u v)
source

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

simple-cyclesclj

(simple-cycles g)

Vector of simple directed cycles, each as a vector of vertices (JohnsonSimpleCycles).

Vector of simple directed cycles, each as a vector of vertices
(JohnsonSimpleCycles).
sourceraw docstring

smallest-degree-last-coloringclj

(smallest-degree-last-coloring g)

Greedy coloring in smallest-degree-last order.

Greedy coloring in smallest-degree-last order.
sourceraw docstring

sorensen-indexclj

(sorensen-index g u v)
source

spannerclj

(spanner g k)

Greedy multiplicative (2k-1)-spanner as {:edges ... :weight w}.

Greedy multiplicative `(2k-1)`-spanner as `{:edges ... :weight w}`.
sourceraw docstring

sparse-edmonds-maximum-matchingclj

(sparse-edmonds-maximum-matching g)

Maximum-cardinality matching using the sparse Edmonds implementation.

Maximum-cardinality matching using the sparse Edmonds implementation.
sourceraw docstring

steiner-treeclj

(steiner-tree g terminals)

Approximate weighted Steiner tree spanning terminals.

Approximate weighted Steiner tree spanning `terminals`.
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

strongly-connected?clj

(strongly-connected? g)

True if directed graph g is strongly connected.

True if directed graph `g` is strongly connected.
sourceraw docstring

subgraph-isomorphic?clj

(subgraph-isomorphic? g subgraph)

True if subgraph is isomorphic to a subgraph of g.

True if `subgraph` is isomorphic to a subgraph of `g`.
sourceraw docstring

szwarcfiter-lauer-simple-cyclesclj

(szwarcfiter-lauer-simple-cycles g)

Simple directed cycles using the Szwarcfiter-Lauer algorithm.

Simple directed cycles using the Szwarcfiter-Lauer algorithm.
sourceraw docstring

tarjan-simple-cyclesclj

(tarjan-simple-cycles g)

Simple directed cycles using Tarjan's algorithm.

Simple directed cycles using Tarjan's algorithm.
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

transitive-closureclj

(transitive-closure g)

Edges of the transitive closure of directed graph g.

Edges of the transitive closure of directed graph `g`.
sourceraw docstring

transitive-reductionclj

(transitive-reduction g)

Edges of the transitive reduction of directed acyclic graph g.

Edges of the transitive reduction of directed acyclic graph `g`.
sourceraw docstring

tree-edit-distanceclj

(tree-edit-distance tree1 root1 tree2 root2)

Zhang-Shasha edit distance between two rooted ordered trees.

Zhang-Shasha edit distance between two rooted ordered trees.
sourceraw docstring

tree-isomorphic?clj

(tree-isomorphic? tree1 tree2)
(tree-isomorphic? tree1 root1 tree2 root2)

AHU tree-isomorphism predicate. The four-argument form fixes both roots.

AHU tree-isomorphism predicate. The four-argument form fixes both roots.
sourceraw docstring

tsp-tourclj

(tsp-tour g)
(tsp-tour g {:keys [method] :or {method :nearest-neighbor}})

Hamiltonian tour as {:tour [v ... v] :weight w}. Methods are :nearest-neighbor (default), :held-karp, :christofides, :greedy, :nearest-insertion, :random, :two-opt, and :palmer.

Hamiltonian tour as `{:tour [v ... v] :weight w}`. Methods are
`:nearest-neighbor` (default), `:held-karp`, `:christofides`, `:greedy`,
`:nearest-insertion`, `:random`, `:two-opt`, and `:palmer`.
sourceraw docstring

vertex-eccentricitiesclj

(vertex-eccentricities g)

Map of vertex -> maximum shortest-path distance to another vertex.

Map of vertex -> maximum shortest-path distance to another vertex.
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

yen-k-shortest-pathsclj

(yen-k-shortest-paths g src dst k)

The k shortest loopless paths from src to dst using Yen's algorithm.

The `k` shortest loopless paths from `src` to `dst` using Yen's algorithm.
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