Color-coding: a new method for finding simple paths, cycles and other small subgraphs within large graphs

Noga Alon, Raphael Yuster, Uri ZwickSTOC 1994

TL;DR

This paper introduces "color-coding," a novel randomized algorithmic technique for efficiently finding small subgraphs (like paths and cycles) within large graphs. This method offers significant speedups over previous approaches and can be derandomized using perfect hash functions, leading to new theoretical bounds for subgraph isomorphism problems.

What Problem Does This Paper Address?

The paper tackles the problem of finding specific small subgraphs within a larger graph, a fundamental task in graph theory and computer science with applications in areas like network analysis and computational biology. While the general subgraph isomorphism problem is NP-complete, finding small subgraphs is often tractable. However, existing algorithms for finding simple paths and cycles of a given length k were often inefficient, especially as k grew. For instance, finding a simple path of length k could take exponential time in k, and finding cycles was similarly challenging. The paper aims to provide more efficient algorithms for these specific cases, particularly when the size of the target subgraph is small relative to the overall graph.

Methods

The core innovation is the color-coding method. The general idea is to randomly color the vertices of the large graph G with k distinct colors, where k is the size of the target subgraph. The key insight is that if a target subgraph exists, there's a good chance it will be "colorful" – meaning all its vertices receive distinct colors. This coloring simplifies the search significantly.

The paper also introduces a related technique called random orientations. This involves randomly permuting the vertices and directing edges from lower-indexed to higher-indexed vertices, creating an acyclic graph. Simple paths in this directed graph correspond to simple paths in the original undirected graph.

Crucially, the paper shows how to derandomize these methods using perfect hash functions. This means the probabilistic speedups can be achieved deterministically, albeit with a slight increase in complexity (often a logarithmic factor).

Datasets

Not discussed in the paper. The paper focuses on theoretical algorithms and their complexity on general graphs, not on specific datasets.

Key Insights and Ideas

  • Coloring for Simplicity: Randomly coloring vertices with k colors transforms the problem of finding a subgraph of size k into finding a "colorful" subgraph. This is much easier because the distinct colors act as unique identifiers for the subgraph's vertices.
  • Paths in Acyclic Graphs: Randomly orienting a graph to make it acyclic provides a way to find simple paths. Any path in such a directed graph is guaranteed to be simple.
  • Derandomization is Key: The ability to derandomize these randomized algorithms using perfect hash functions is a major contribution, bridging the gap between theoretical probabilistic algorithms and practical deterministic solutions.
  • Generalization to Bounded Tree-Width: The color-coding method can be generalized to find any subgraph whose tree-width is bounded, significantly extending its applicability beyond just paths and cycles. This resolves a conjecture by Papadimitriou and Yannakakis regarding the LOG PATH problem.

Key Results

  • Finding Simple Cycles: For a fixed k, a simple cycle of length k in a graph G=(V,E) can be found in O(Vω) expected time (where ω is the matrix multiplication exponent, < 2.376) or O(Vω log V) worst-case time. For planar graphs, this improves to O(V) expected time or O(V log V) worst-case time.
  • Finding Simple Paths: A simple path of length k can be found in 2^O(k) * E expected time or 2^O(k) * E log V worst-case time. This resolves a conjecture about finding paths of length log V in polynomial time.
  • Bounded Tree-Width Subgraphs: If a graph G contains a subgraph isomorphic to a bounded tree-width graph H with |VH| = O(log V), such a copy can be found in polynomial time. This is a significant generalization of previous results.
  • Derandomized Bounds: The randomized algorithms can be derandomized with only a small loss in efficiency, retaining the 2^O(k) dependence while adding a log V factor.

Limitations and Future Work

  • Exponential Dependence on k: The algorithms still exhibit an exponential dependence on k (the size of the target subgraph). This is likely unavoidable for general graphs, as the problem becomes NP-complete if k is part of the input.
  • Complexity for Derandomization: While derandomization is achieved, the complexity can increase by a factor of log V or log² V depending on the specific construction of perfect hash functions used.
  • Future Work: The paper suggests that the color-coding method can be generalized to find any subgraph with bounded tree-width, which is presented in Section 6. The authors also mention that their algorithms can be easily parallelized. The paper also hints at further applications and more efficient solutions for specific graph classes.

Summary updated

BibTeX
@inproceedings{alon1994color,
  author = {Noga Alon and Raphael Yuster and Uri Zwick},
  title = {{Color-coding: a new method for finding simple paths, cycles and other small subgraphs within large graphs}},
  booktitle = {STOC},
  year = {1994},
  doi = {10.1145/195058.195179},
}
Figure