NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Quantum Algorithms for the Triangle Problem

Frédéric Magniez, Miklos Santha, Mario SzegedySIAM Journal on Computing 2005

TL;DR

This paper introduces two novel quantum algorithms for efficiently detecting triangles (a complete subgraph of size 3) in large, undirected graphs. The first algorithm achieves a query complexity of $\tilde{O}(n^{10/7})$ using combinatorial insights and Grover search, while the second, more advanced algorithm, leverages quantum walks and achieves $\tilde{O}(n^{13/10})$. These results significantly improve upon previous quantum algorithms for this fundamental graph problem.

What Problem Does This Paper Address?

The paper tackles the "Triangle Problem," a fundamental task in graph theory and computer science: determining if a given undirected graph contains a triangle (a complete subgraph of three vertices). This problem has implications in various fields, including social network analysis (finding groups of three mutually connected individuals) and database querying. While classical algorithms exist, their efficiency can be limited for large graphs. The paper focuses on the quantum query complexity, a model where the cost is measured by the number of times an algorithm needs to query an oracle (in this case, the graph's adjacency matrix). Previous quantum algorithms for triangle detection had a query complexity of $\tilde{O}(n^{3/2})$ or $\tilde{O}(n + \sqrt{nm})$ for sparse graphs, leaving room for improvement, especially for dense graphs.

Methods

The paper presents two main algorithmic approaches:

  • Combinatorial Approach (Algorithm 1): This algorithm leverages a combination of combinatorial observations and a safe version of Grover's search algorithm. It involves randomly sampling vertices, checking their neighborhoods, and then classifying the remaining edges into two sets: those likely to form triangles within a dense subgraph and those that might intersect with a sparse subgraph. Grover's search is then applied to these sets. A key insight is that hard instances of the triangle problem tend to be dense, and the algorithm exploits this by using techniques like the Szemerédi Lemma.
  • Quantum Walk Approach (Algorithm 2): This algorithm builds upon a more recent technique by Ambainis, which uses quantum walks to enhance Grover search. It introduces a "Graph Collision Problem" as an intermediate step, which is then used to solve the Triangle Problem. This approach is more sophisticated and achieves a better query complexity.

Both algorithms utilize a "safe" version of Grover's search, which guarantees rejection if no marked item is found, and a high probability of finding a marked item otherwise.

Datasets

Not discussed in the paper. The problem is defined on abstract graphs, and no specific datasets are used for training or evaluation.

Key Insights and Ideas

  • Density is Key: The paper highlights that the difficulty of the triangle problem is related to the density of the graph. Dense graphs present a harder challenge for some algorithms, and the proposed solutions exploit this characteristic.
  • Combinatorial Insights Enhance Quantum Search: The first algorithm demonstrates how clever combinatorial partitioning of graph edges can significantly improve the efficiency of quantum search algorithms like Grover's.
  • Quantum Walks as a Powerful Tool: The second algorithm showcases the power of quantum walks, as introduced by Ambainis, in boosting the performance of quantum query algorithms for problems like triangle detection.
  • Problem Decomposition: Introducing intermediate problems like the "Graph Collision Problem" can simplify the analysis and lead to more efficient solutions for the main problem.

Key Results

  • Algorithm 1: Achieves a quantum query complexity of $\tilde{O}(n^{10/7})$ for finding a triangle in a graph with $n$ vertices. This algorithm uses only $O(\log n)$ qubits in its quantum subroutines.
  • Algorithm 2: Achieves a quantum query complexity of $\tilde{O}(n^{13/10})$ for the same problem. This algorithm uses $O(n)$ qubits.
  • Generalization: The paper also generalizes its findings to finding copies of any given graph $H$ with $k$ vertices, achieving a query complexity of $\tilde{O}(n^{2-2/k})$.

Limitations and Future Work

  • Query Complexity Focus: The paper primarily focuses on query complexity, not overall time complexity. While query complexity is a crucial metric in quantum computation, other factors like the number of gates or total running time might differ.
  • Probabilistic Nature: The algorithms are probabilistic, meaning they have a small probability of error. The paper addresses this by using "safe" algorithms and union bounds to ensure a high overall probability of correctness.
  • Future Work: The paper suggests extending these results to finding copies of general graphs and other monotone graph properties with small certificates. The authors also note that the $\Omega(n^{2/3})$ lower bound for randomized algorithms for triangle detection is still a significant gap to bridge for quantum algorithms.

Summary updated

BibTeX
@article{magniez2005quantum,
  author = {Frédéric Magniez and Miklos Santha and Mario Szegedy},
  title = {{Quantum Algorithms for the Triangle Problem}},
  journal = {SIAM Journal on Computing},
  year = {2005},
  url = {https://openreview.net/forum?id=Tk3AhMvxZA},
}
Figure