Samyama Graph Algorithms
A high-performance, Rust-native library for graph analytics and topology analysis. Optimized for the Samyama Graph Database but usable as a standalone crate.
Features
This library implements standard algorithms optimized for GraphView (a compact Adjacency List projection).
🔍 Pathfinding
- BFS (Breadth-First Search): Find the shortest path in unweighted graphs.
- Dijkstra: Find the shortest path in weighted graphs.
🌐 Centrality & Community
- PageRank: Measure node importance/influence.
- Weakly Connected Components (WCC): Find disjoint subgraphs.
- Strongly Connected Components (SCC): Find cycles and strongly connected clusters using Tarjan's algorithm.
⚡ Flow & Topology
- Max Flow (Edmonds-Karp): Calculate the maximum flow capacity between source and sink nodes.
- Minimum Spanning Tree (Prim's): Find the MST of a weighted graph.
- Triangle Counting: Analyze graph density and clustering coefficients.
Usage
1. Define a Graph View
The library operates on a GraphView, which is a read-only projection of your graph data.
use ;
use HashMap;
// Manually construct a view (or build from your storage engine)
let view = GraphView ;
2. Run Algorithms
PageRank:
use ;
let config = default; // damping: 0.85, iter: 20
let scores = page_rank;
for in scores
Shortest Path:
use dijkstra;
// Find shortest path from ID 10 to ID 30
if let Some = dijkstra
Max Flow:
use edmonds_karp;
// Calculate max flow from Source(10) to Sink(30)
if let Some = edmonds_karp
Integration with Samyama
This crate is the backend for algo.* Cypher procedures in Samyama.
| Algorithm | Cypher Procedure |
|---|---|
| PageRank | CALL algo.pageRank('Label', 'REL') |
| WCC | CALL algo.wcc() |
| SCC | CALL algo.scc() |
| Max Flow | CALL algo.maxFlow(source, sink, 'capacity') |
| MST | CALL algo.mst('weight') |
| Triangle Count | CALL algo.triangleCount() |
License
Apache-2.0