A Practical Parallel Algorithm for Diameter Approximation of Massive Weighted Graphs

Matteo Ceccarello, Andrea Pietracaprina, Geppino Pucci, Eli Upfal

TL;DR

This paper introduces a space- and time-efficient parallel algorithm for approximating the diameter of massive weighted graphs on distributed platforms like Apache Spark. By cleverly partitioning the graph into bounded-radius clusters using an adaptive thresholding strategy, the algorithm achieves up to a 100x speedup over the state-of-the-art $\Delta$-stepping approach while maintaining a highly accurate approximation ratio of under 1.4 in practice.

What Problem Does This Paper Address?

Graph analytics frequently relies on knowing a graph's diameter (the maximum shortest-path distance between any two nodes). For massive graphs, computing this exactly using All-Pairs Shortest Paths (APSP) is computationally impossible due to extreme memory and time requirements.

While approximations exist, the standard approach for weighted graphs in parallel environments is to run a Single-Source Shortest Path (SSSP) algorithm, specifically $\Delta$-stepping, from a random node. However, in distributed, loosely-coupled environments like MapReduce or Apache Spark, $\Delta$-stepping suffers from a "long critical path"—it requires too many sequential communication rounds. Because network synchronization between rounds is the primary bottleneck in these systems, $\Delta$-stepping becomes unfeasibly slow. The authors tackle the challenge of minimizing these communication rounds while strictly using linear aggregate space, specifically addressing the complexities introduced by edge weights.

Methods

The core of the algorithm is a novel parallel graph decomposition strategy. Instead of computing paths across the whole graph at once, the algorithm breaks the graph down into smaller, disjoint clusters.

  1. Progressive Cluster Growing: The algorithm randomly selects a batch of "center" nodes and grows clusters outward from them in parallel.
  2. Adaptive Thresholding ($\Delta$): In an unweighted graph, you can just absorb all immediate neighbors into a cluster. In a weighted graph, absorbing a neighbor via a "heavy" edge ruins the cluster's radius and destroys the approximation quality. To fix this, the authors limit cluster growth using a weight threshold ($\Delta$).
  3. Doubling Strategy: Because the optimal threshold isn't known in advance, the algorithm uses a "doubling strategy" to automatically guess and tune $\Delta$, ensuring clusters grow efficiently without absorbing heavy edges prematurely.
  4. Quotient Graph: Once the massive graph is partitioned into these bounded-radius clusters, it is contracted into a much smaller "quotient graph" (where clusters become single nodes). The diameter of this small graph is computed locally on a single machine, providing the final approximation for the massive original graph.

Datasets

The authors evaluated their algorithm on a mix of real-world and synthetic benchmark graphs, scaling up to roughly 1 billion nodes and several billion edges:

  • Real-world Road Networks: roads-USA, roads-CAL (natively weighted).
  • Real-world Social Networks: livejournal, twitter (assigned random uniform weights).
  • Synthetic Graphs: mesh(S) (square meshes), R-MAT(S) (power-law degree distribution graphs), and roads(S) (artificially scaled-up road networks).

Key Insights and Ideas

  • Theory vs. Practice Gap: Theoretically, the algorithm guarantees an $O(\log^3 n)$ approximation ratio. However, the "aha moment" of the experiments is that the real-world approximation ratio never exceeded 1.4. This proves that the worst-case mathematical bounds are overly pessimistic for actual graph topologies.
  • Fewer Rounds = Massive Speedups: In MapReduce/Spark, computation is cheap, but network I/O and synchronization (rounds) are expensive. By bounding cluster growth and using the doubling strategy, this algorithm drastically cuts down the number of rounds compared to $\Delta$-stepping, directly translating to massive wall-clock speedups.
  • Exploiting Spatial Properties: The authors mathematically prove that for graphs with a "bounded doubling dimension" (like physical road networks or spatial grids), their algorithm is strictly and asymptotically faster than $\Delta$-stepping under linear space constraints.

Key Results

  • Speed: The proposed algorithm (dubbed CL-DIAM) was one to two orders of magnitude faster than a Spark implementation of $\Delta$-stepping. For example, on the roads-USA graph, CL-DIAM finished in 158 seconds, while $\Delta$-stepping took 14,982 seconds.
  • Accuracy: Across all benchmarks, the approximation ratio remained between 1.19 and 1.33, highly comparable to the baseline SSSP approach.
  • Efficiency: CL-DIAM required vastly fewer communication rounds (e.g., 74 rounds vs 11,268 rounds for roads-USA) and generated significantly less total work (measured in node updates and messages).
  • Scalability: The algorithm demonstrated excellent strong scaling when moving from 2 to 16 machines on billion-edge synthetic graphs.

Limitations and Future Work

The authors acknowledge that for graphs with highly skewed topologies or extreme weight distributions, the algorithm might require a large number of growing steps, reducing its competitive advantage over $\Delta$-stepping. While they propose a theoretical workaround for this (capping the number of growth steps), doing so incurs a slight penalty to the theoretical approximation ratio. Future work could explore optimizing these fallback mechanisms for highly skewed graphs or applying this bounded-depth clustering technique to other distributed graph primitives.

Summary updated

BibTeX
@inproceedings{ceccarello2016practical,
  author = {Matteo Ceccarello and Andrea Pietracaprina and Geppino Pucci and Eli Upfal},
  title = {{A Practical Parallel Algorithm for Diameter Approximation of Massive Weighted Graphs}},
  booktitle = {IPDPS},
  year = {2016},
  doi = {10.1109/ipdps.2016.61},
}
Figure