Skip to main content

Module functions

Module functions 

Source
Expand description

Auto-generated module

🤖 Generated with SplitRS

Functions§

adjacency_matrix
Returns adjacency matrix as a flat nĂ—n Vecf64.
astar
A* shortest path from start to goal with a heuristic h(node) -> f64.
average_clustering
Average clustering coefficient across all nodes.
bellman_ford
Bellman-Ford shortest-path algorithm from start.
betweenness_centrality
Computes approximate betweenness centrality using Dijkstra for each source.
bfs
Returns nodes visited in BFS order starting from start.
bfs_distances
BFS distances from start (unweighted). usize::MAX = unreachable.
bipartite_coloring
Returns the 2-colouring as Some(colors) if bipartite, None otherwise.
bipartite_matching
Augmenting-path maximum bipartite matching.
chromatic_number_upper_bound
Returns the number of colours used by a colouring vector.
closeness_centrality
Computes closeness centrality for every node.
connected_components
Returns the connected components of the graph (treating all edges as undirected).
contact_graph_from_overlaps
Creates a contact graph from a list of overlapping body pairs.
count_back_edges
Counts directed cycles (simple) in the graph using DFS coloring.
degree_centrality
Degree centrality: returns degree(v) / (n-1) for each node.
dfs
Returns nodes visited in DFS order starting from start (iterative).
dijkstra
Dijkstra’s shortest-path algorithm from start.
dijkstra_with_path
Dijkstra with both distances and predecessor array.
distance_matrix_to_graph
Convert a distance matrix to a sparse graph (threshold edges).
floyd_warshall
Floyd-Warshall all-pairs shortest paths.
graph_density
Graph density: |E| / (|V| * (|V| - 1)) for directed graphs.
graph_diameter_bfs
Returns the diameter of the graph: the longest shortest path.
greedy_coloring
Greedy graph colouring.
has_eulerian_circuit
Returns true if the (undirected) graph has an Eulerian circuit.
has_eulerian_path
Returns true if the (undirected) graph has an Eulerian path (but not a circuit).
is_bipartite
Returns true if the undirected graph (edges treated as undirected) is bipartite.
is_connected
Returns true if the graph is connected (treating all edges as undirected).
is_dag
Returns true if the directed graph is a DAG (no directed cycles).
island_count
Returns the number of connected components (physics “islands”).
kahn_topological_sort
Kahn’s algorithm for topological sorting (BFS / in-degree approach).
kosaraju_scc
Kosaraju’s algorithm for strongly connected components (SCCs).
kruskal_mst
Kruskal’s MST algorithm for an undirected graph.
laplacian_matrix
Computes the graph Laplacian matrix L = D - A for an undirected graph.
local_clustering
Local clustering coefficient for node u (undirected interpretation).
max_flow_edmonds_karp
Edmonds-Karp max-flow algorithm (BFS augmenting paths).
mst_total_weight
Returns the total weight of an MST (or any edge list).
path_reconstruct
Reconstructs the path to end from a prev array produced by a shortest-path algorithm.
prim_mst
Prim’s minimum spanning tree algorithm.
tarjan_scc
Tarjan’s algorithm for strongly connected components.
topological_sort
Topological sort using Kahn’s algorithm.