Expand description
Graph Algorithms for RedDB
High-performance graph algorithms optimized for attack path analysis:
- PageRank: Identify critical nodes
- Connected Components: Find isolated network segments
- Betweenness Centrality: Find chokepoints
- Community Detection: Cluster related assets
- Cycle Detection: Find lateral movement loops
§Algorithm Complexity
| Algorithm | Time Complexity | Space Complexity | Notes |
|---|---|---|---|
| PageRank | O(V + E) per iter | O(V) | Converges in ~20-50 iterations |
| Connected Components | O(V + E) | O(V) | Union-Find with path compress |
| Betweenness Centrality | O(V × E) | O(V + E) | Brandes’ algorithm |
| Community Detection | O(V + E) per iter | O(V) | Label propagation, ~5-10 iters |
| Cycle Detection | O(V + E) | O(V + cycles) | DFS with rotation dedup |
| BFS Path Finding | O(V + E) | O(V) | Single-source shortest path |
| Dijkstra (weighted) | O((V+E) log V) | O(V) | Priority queue based |
| K-Shortest Paths | O(K × V × E) | O(K × V) | Yen’s algorithm |
Where V = vertices (nodes), E = edges.
§Performance Benchmarks
On a graph with 1M edges (typical enterprise network):
- Graph creation: ~2 seconds
- PageRank: ~500ms (50 iterations)
- Connected Components: ~100ms
- Communities: ~300ms (10 iterations)
On a graph with 100K edges:
- Betweenness Centrality: ~5 seconds (O(V×E))
On a graph with 10K edges:
- Cycle Detection: ~50ms
§Example
ⓘ
use reddb::storage::engine::algorithms::{PageRank, ConnectedComponents};
let pr = PageRank::new(&graph).run();
let components = ConnectedComponents::new(&graph).find();Structs§
- Betweenness
Centrality - Betweenness centrality computation using Brandes’ algorithm
- Betweenness
Result - Result of betweenness centrality computation
- Closeness
Centrality - Closeness centrality measures how close a node is to all other nodes
- Closeness
Result - Result of closeness centrality computation
- Clustering
Coefficient - Local and global clustering coefficient
- Clustering
Result - Result of clustering coefficient computation
- Communities
Result - Result of community detection
- Community
- A community of nodes
- Component
- A connected component in the graph
- Components
Result - Result of connected components computation
- Connected
Components - Connected components finder
- Cycle
- A cycle in the graph
- Cycle
Detector - DFS-based cycle detection
- Cycles
Result - Result of cycle detection
- Degree
Centrality - Degree centrality measures node importance by connection count
- Degree
Centrality Result - Result of degree centrality computation
- Eigenvector
Centrality - Eigenvector centrality: importance based on neighbor importance
- Eigenvector
Result - Result of eigenvector centrality computation
- HITS
- HITS algorithm: Identifies hubs and authorities
- HITS
Result - Result of HITS computation
- Label
Propagation - Label Propagation Algorithm for community detection
- Louvain
- Louvain algorithm for community detection
- Louvain
Result - Result of Louvain community detection
- Page
Rank - PageRank algorithm for identifying critical nodes
- Page
Rank Result - Result of PageRank computation
- Personalized
Page Rank - Personalized PageRank - teleport only to specified seed nodes
- SCCResult
- Result of SCC computation
- Strongly
Connected Components - Strongly connected components using Tarjan’s algorithm
- Triangle
Counting - Count triangles in the graph
- Triangle
Result - Result of triangle counting
- WCCResult
- Result of weakly connected components
- Weakly
Connected Components - Weakly connected components - treats directed graph as undirected