Divide & Conquer: I/O Efficient Depth-First Search

Zhiwei Zhang, Jeffrey Xu Yu, Lu Qin, Zechao ShangSIGMOD 2015

TL;DR

This paper tackles the challenge of performing Depth-First Search (DFS) on massive graphs that don't fit into main memory. They introduce a novel "divide and conquer" approach that breaks down the graph into smaller, manageable subgraphs, computes DFS-Trees for each, and then merges them. This significantly reduces I/O operations, making DFS practical for enormous datasets.

What Problem Does This Paper Address?

Depth-First Search (DFS) is a fundamental graph algorithm used in countless applications, from finding connected components to topological sorting. Traditionally, DFS algorithms assume the entire graph can be loaded into main memory, allowing for linear-time execution. However, with the explosion of big data, real-world graphs (like social networks or the web graph) have grown so large that they far exceed available RAM. Existing "semi-external" DFS algorithms, which assume a graph's spanning tree can fit in memory, still suffer from high I/O costs and a large number of iterations, making them impractical for truly massive graphs. This paper aims to bridge this gap by developing an I/O-efficient DFS algorithm for graphs that are too large to fit in memory.

Methods

The core of the paper's contribution is a new "divide and conquer" framework for semi-external DFS. The strategy involves:

  • Graph Division: The large graph G is recursively divided into smaller subgraphs (G₀, G₁, ..., Gₚ). This division is designed to be "valid," meaning the DFS-Trees of the subgraphs can be combined to form the DFS-Tree of the original graph without introducing forward-cross edges.
  • Subgraph DFS-Tree Computation: The DFS-Tree for each subgraph is computed independently. If a subgraph is still too large, it's further divided.
  • S-Graph for Relationships: A crucial innovation is the introduction of an "S-Graph" (Summary Graph). This is a much smaller graph that captures the relationships between the divided subgraphs. It allows for efficient checking of the "DFS-preservable" property (ensuring sub-DFS-Trees can be merged correctly) without rescanning the entire original graph.
  • SCC-Aware Division: To handle cycles that can arise in the S-Graph, the authors employ an "SCC-aware" division strategy. This involves identifying Strongly Connected Components (SCCs) in the S-Graph and contracting them, ensuring the resulting S-Graph is a Directed Acyclic Graph (DAG).
  • Merge Algorithm: A specialized merge algorithm combines the DFS-Trees of the subgraphs, guided by the S-Graph, to construct the final DFS-Tree for the entire graph. This merge process handles "virtual nodes" introduced during SCC contraction.

Two specific division algorithms, Divide-Star (dividing based on children of the root) and Divide-TD (a more advanced multi-level cut-tree approach), are proposed.

Datasets

The authors evaluated their algorithms using:

  • Real-world Datasets:
    • wikilinks (25.9M nodes, 601M edges)
    • arabic-2005 (22.7M nodes, 640M edges)
    • twitter-2010 (41.6M nodes, 1.47B edges)
    • webspam-uk2007 (105.9M nodes, 3.74B edges)
  • Synthetic Datasets:
    • Random graphs
    • Power-law graphs

These datasets vary in size, average degree, and structural properties (like power-law distribution) to test the algorithms' scalability and robustness.

Key Insights and Ideas

  • Divide and Conquer is Key for I/O Efficiency: The fundamental insight is that breaking a massive graph into smaller, independently processable chunks dramatically reduces the number of I/O operations required.
  • S-Graph as a Lightweight Supervisor: The S-Graph is a clever abstraction. It summarizes inter-subgraph relationships, enabling efficient validation of the division and guiding the merge process without needing to access the full original graph data repeatedly.
  • SCCs are Crucial for Valid Divisions: Cycles in the S-Graph indicate invalid divisions. The SCC-aware contraction strategy is essential for ensuring that the division is "DFS-preservable" and that the final merged tree is a correct DFS-Tree.
  • Divide-TD Outperforms Divide-Star: The more sophisticated Divide-TD algorithm, which considers multiple levels of the spanning tree for division, consistently performs better, especially with larger memory sizes, by creating more subgraphs.

Key Results

The experimental results demonstrate the significant advantage of the proposed divide and conquer approach over the existing SEMI-DFS algorithm:

  • Substantial Speedup: Across all tested real-world and synthetic datasets, both Divide-Star and Divide-TD significantly outperform SEMI-DFS in terms of processing time and I/O operations.
  • Scalability: The proposed algorithms scale much better with increasing graph size (number of nodes and edges) and memory constraints.
  • Robustness: Divide-TD shows a slower increasing rate of cost as graph size or edge density increases, indicating better scalability.
  • Practicality: For very large graphs (e.g., webspam-uk2007), SEMI-DFS fails to complete within reasonable time limits, while Divide-TD successfully computes the DFS-Tree.

Limitations and Future Work

  • Memory Constraint: The algorithms still rely on the assumption that a spanning tree of the graph can fit into main memory. For graphs where even the spanning tree is too large, further research would be needed.
  • Virtual Nodes: While the merge algorithm handles virtual nodes introduced by SCC contraction, the process adds complexity. Future work might explore ways to avoid or simplify this.
  • Further Optimization: The paper suggests that Divide-TD is a generalization of Divide-Star and outperforms it, implying that further refinements to the division and merge strategies could yield even better results. The authors' experimental setup and analysis provide a strong foundation for future research in I/O-efficient graph algorithms.

Summary updated

BibTeX
@inproceedings{zhang2015divide,
  author = {Zhiwei Zhang and Jeffrey Xu Yu and Lu Qin and Zechao Shang},
  title = {{Divide \& Conquer: I/O Efficient Depth-First Search}},
  booktitle = {SIGMOD},
  year = {2015},
  doi = {10.1145/2723372.2723740},
}
Figure