Expand description
Graph algorithms for Graphos.
This module provides high-performance graph algorithm implementations inspired by rustworkx and GRAPE. Algorithms are designed to work with the Graphos LPG store and can be exposed to Python via bridges.
§Algorithm Categories
traversal- BFS, DFS with visitor patterncomponents- Connected components, SCC, topological sortshortest_path- Dijkstra, A*, Bellman-Ford, Floyd-Warshall
§Usage
ⓘ
use graphos_adapters::plugins::algorithms::{bfs, dfs, connected_components, dijkstra};
use graphos_core::graph::lpg::LpgStore;
use graphos_common::types::NodeId;
let store = LpgStore::new();
// ... populate graph ...
// Run BFS from node 0
let visited = bfs(&store, NodeId::new(0));
// Find connected components
let components = connected_components(&store);
// Run Dijkstra's shortest path
let result = dijkstra(&store, NodeId::new(0), Some("weight"));Structs§
- Articulation
Points Algorithm - Articulation Points algorithm wrapper.
- Bellman
Ford Algorithm - Bellman-Ford algorithm wrapper for the plugin registry.
- Bellman
Ford Result - Result of Bellman-Ford algorithm.
- Betweenness
Centrality Algorithm - Betweenness centrality algorithm wrapper.
- BfsAlgorithm
- BFS algorithm wrapper for the plugin registry.
- Bridges
Algorithm - Bridges algorithm wrapper.
- Closeness
Centrality Algorithm - Closeness centrality algorithm wrapper.
- Connected
Components Algorithm - Connected components algorithm wrapper.
- Degree
Centrality Algorithm - Degree centrality algorithm wrapper.
- Degree
Centrality Result - Result of degree centrality computation.
- DfsAlgorithm
- DFS algorithm wrapper for the plugin registry.
- Dijkstra
Algorithm - Dijkstra algorithm wrapper for the plugin registry.
- Dijkstra
Result - Result of Dijkstra’s algorithm.
- Floyd
Warshall Algorithm - Floyd-Warshall algorithm wrapper for the plugin registry.
- Floyd
Warshall Result - Result of Floyd-Warshall algorithm.
- KCore
Algorithm - K-Core decomposition algorithm wrapper.
- KCore
Result - Result of k-core decomposition.
- Kruskal
Algorithm - Kruskal’s MST algorithm wrapper.
- Label
Propagation Algorithm - Label Propagation algorithm wrapper.
- Louvain
Algorithm - Louvain algorithm wrapper.
- Louvain
Result - Result of Louvain algorithm.
- MaxFlow
Algorithm - Max Flow algorithm wrapper.
- MaxFlow
Result - Result of max flow algorithm.
- MinCost
Flow Algorithm - Min Cost Max Flow algorithm wrapper.
- MinCost
Flow Result - Result of min cost max flow algorithm.
- MinScored
- Wrapper for priority queue ordering (min-heap behavior).
- MstResult
- Result of MST algorithms.
- Page
Rank Algorithm - PageRank algorithm wrapper for the plugin registry.
- Prim
Algorithm - Prim’s MST algorithm wrapper.
- Strongly
Connected Components Algorithm - Strongly connected components algorithm wrapper.
- Topological
Sort Algorithm - Topological sort algorithm wrapper.
- Union
Find - Union-Find (Disjoint Set Union) with path compression and union by rank.
Enums§
- Control
- Control flow for algorithm visitors.
- Traversal
Event - Events emitted during graph traversal (BFS/DFS).
Traits§
- Distance
Map - A map from nodes to distances/costs.
- Graph
Algorithm - A graph algorithm that can be executed on an LPG store.
- Parallel
Graph Algorithm - A graph algorithm that supports parallel execution.
Functions§
- articulation_
points - Finds articulation points (cut vertices) in the graph.
- astar
- Runs A* algorithm with a heuristic function.
- bellman_
ford - Runs Bellman-Ford algorithm from a source node.
- betweenness_
centrality - Computes betweenness centrality using Brandes’ algorithm.
- bfs
- Performs breadth-first search from a starting node.
- bfs_
layers - BFS layers - returns nodes grouped by their distance from the start.
- bfs_
with_ visitor - Performs breadth-first search with a visitor callback.
- bridges
- Finds bridges (cut edges) in the graph.
- closeness_
centrality - Computes closeness centrality for all nodes.
- community_
count - Returns the number of communities detected.
- connected_
component_ count - Returns the number of connected components.
- connected_
components - Finds connected components in an undirected graph (or weakly connected components in a directed graph).
- degree_
centrality - Computes degree centrality for all nodes.
- degree_
centrality_ normalized - Computes normalized degree centrality.
- dfs
- Performs depth-first search from a starting node.
- dfs_all
- Performs DFS on all nodes, visiting each connected component.
- dfs_
with_ visitor - Performs depth-first search with a visitor callback.
- dijkstra
- Runs Dijkstra’s algorithm from a source node.
- dijkstra_
path - Runs Dijkstra’s algorithm to find shortest path to a specific target.
- floyd_
warshall - Runs Floyd-Warshall algorithm for all-pairs shortest paths.
- is_dag
- Checks if the graph is a DAG (Directed Acyclic Graph).
- k_core
- Extracts the k-core subgraph (nodes with core number >= k).
- kcore_
decomposition - Computes the k-core decomposition of the graph.
- kruskal
- Computes the Minimum Spanning Tree using Kruskal’s algorithm.
- label_
propagation - Detects communities using the Label Propagation Algorithm.
- louvain
- Detects communities using the Louvain algorithm.
- max_
flow - Computes maximum flow using the Edmonds-Karp algorithm.
- min_
cost_ max_ flow - Computes minimum cost maximum flow using successive shortest paths.
- pagerank
- Computes PageRank for all nodes using power iteration.
- prim
- Computes the Minimum Spanning Tree using Prim’s algorithm.
- strongly_
connected_ component_ count - Returns the number of strongly connected components.
- strongly_
connected_ components - Finds strongly connected components in a directed graph using Tarjan’s algorithm.
- topological_
sort - Performs topological sort on a directed acyclic graph using Kahn’s algorithm.