Abstract
Graphs are essential for modeling complex interactions, yet assessing their structure—particularly through triadic measures like clustering coefficients—is computationally expensive. We introduce a "wedge sampling" framework that provides fast and accurate approximations of these metrics. By sampling paths of length two ("wedges") rather than enumerating every triangle, our method achieves orders-of-magnitude speedups with provable accuracy bounds independent of graph size. Our results demonstrate that this technique enables wide-scale adoption of triadic measures for the analysis of extremely large real-world graphs.
Introduction
In network science, triangles serve as the fundamental unit for measuring social cohesion and transitivity. Metrics such as the clustering coefficient are vital for applications ranging from spam detection to community discovery. However, as datasets scale to millions or billions of edges, traditional triangle counting algorithms ($O(m^{1.5})$) become prohibitively slow. Existing approximation methods often suffer from high variance or fail to estimate local, vertex-specific metrics accurately. The authors propose a method that is fast, versatile, and mathematically robust.
The Wedge Sampling Framework
The core innovation of this work is the shift from edge-based sampling to wedge sampling. A wedge is defined as a path of length two: three nodes connected by two edges. When the endpoints of a wedge are connected by a third edge, the wedge is "closed," forming a triangle.
The general algorithmic template involves:
- Vertex Selection: Choosing a "center" vertex with probability proportional to the number of wedges it centers (related to its degree).
- Wedge Formation: Randomly selecting two neighbors of that vertex.
- Closure Check: Verifying if an edge exists between the two neighbors.
- Aggregation: Estimating the clustering coefficient based on the fraction of sampled wedges that are closed.
This versatile framework allows for the estimation of global clustering coefficients, local (vertex-specific) coefficients, and degree-wise transitivity.
Theoretical Rigor and Size-Independence
A key theoretical insight is that the number of samples required for a specific error bound depends solely on the desired confidence level, not the total number of nodes or edges in the graph. Using Chernoff-Hoeffding bounds, the authors demonstrate that a fixed number of samples can guarantee high precision (e.g., within 1% error) for any graph, regardless of its scale. This makes wedge sampling uniquely suited for massive, billion-edge networks where full enumeration is computationally impossible.
Experimental Results
The authors evaluated their methods on 13 diverse real-world graphs from the Stanford Network Analysis Project (SNAP), including social networks (Flickr, LiveJournal), web graphs, and infrastructure networks.
Performance Gains
Wedge sampling consistently delivered massive speedups, often ranging from 1,000x to 10,000x faster than state-of-the-art enumeration. For instance, on the as-skitter graph, enumeration required 90 seconds, while wedge sampling provided an accurate estimate in just 0.015 seconds.
Accuracy and Stability
With as few as 2,000 to 32,000 samples, the algorithm's estimates consistently remained within 1% of the true values. Unlike edge-sampling techniques (such as Doulion), which struggle with local metrics and high variance, wedge sampling proved remarkably stable across different graph topologies and sizes.
Conclusion
Wedge sampling represents a significant advancement in graph analysis, offering a mathematically robust and computationally efficient alternative to triangle enumeration. By providing a flexible template for various triadic measures, this method enables the analysis of extremely large graphs that were previously out of reach. Future directions include extending this framework to directed graphs and higher-order structures like 4-cycles or 4-cliques.
Summary updated