Abstract
Graph algorithms are fundamental to modern applications like blockchains and social networks. However, the shift from static to dynamic data environments poses significant challenges for maintaining consistency and performance. This paper introduces PANIGRAHAM, a library of concurrent shared-memory algorithms for breadth-first search (BFS), single-source shortest-path (SSSP), and betweenness centrality (BC). By utilizing a novel multi-scan validation technique and composite lock-free data structures, PANIGRAHAM provides linearizable and non-blocking graph analytics that scale effectively with multi-core processors.
Introduction: The Challenge of Dynamic Graphs
In real-world systems, graphs are rarely static. They evolve constantly as nodes and edges are added or removed. Traditional approaches to graph analytics on these dynamic structures often face a trade-off between consistency and performance. "Stop-the-world" locking ensures consistency but halts updates, while querying static snapshots leads to stale results. Concurrent execution without synchronization can lead to inconsistent results that do not reflect any valid state of the graph.
PANIGRAHAM addresses these issues by providing a framework that is both linearizable (results are consistent with a specific point in time) and non-blocking (ensuring system-wide progress).
Methodology: The PANIGRAHAM Framework
The framework's architecture relies on two primary innovations: a composite data structure and a multi-scan validation protocol.
Composite Data Structure
Instead of a monolithic structure, PANIGRAHAM represents the graph as a composition of lock-free sets. A lock-free hash table stores vertices (VNode), each of which points to its own lock-free adjacency structure (conceptually a Binary Search Tree) containing outgoing edges (ENode). This modularity allows updates to different parts of the graph to proceed in parallel without global contention.
Multi-Scan/Validate Framework
To ensure that complex queries like BFS observe a consistent state, the library employs a "collect-and-compare" strategy. A query thread performs an initial "tree collect" to gather a partial snapshot. It then repeats this collection. If the two snapshots match—verified by comparing version counters (ecnt) and pointers—the state is guaranteed to be consistent.
Update operations are designed to be lock-free, ensuring at least one thread always makes progress. Queries are obstruction-free, meaning a thread will complete its operation if it is not continuously interrupted by concurrent updates.
Experimental Evaluation
The researchers evaluated PANIGRAHAM using synthetic R-MAT (Recursive Matrix) graphs, which mimic the power-law distributions found in real-world networks. Tests involved graphs with up to 131K vertices and 1 million edges, subjected to various workloads of updates and search queries.
Key Results
- Superior Performance: In dynamic settings with 56 threads, PANIGRAHAM outperformed the highly optimized Ligra library by up to 10x for BFS, SSSP, and BC algorithms. While Ligra excels in static environments, its performance degrades significantly under intermittent updates.
- Scalability: The algorithms demonstrated strong scalability, with execution times decreasing consistently as the number of threads increased from 7 to 56.
- Practical Validation Overhead: Despite the theoretical risk of multiple retries in the multi-scan approach, the authors found that consistency was typically achieved within 4-8 collects, even under high update pressure.
Conclusion and Future Work
PANIGRAHAM demonstrates that complex, consistent graph analytics can be built by nesting simpler concurrent primitives. While linearizability introduces some overhead compared to relaxed consistency models, it is essential for correctness in many domains.
Future work may address the current limitation of obstruction-freedom, where a barrage of updates could theoretically starve a query thread. Additionally, extending these techniques to undirected graphs and exploring approximate analytics for massive streaming datasets remain promising avenues for research.
Summary updated