In the world of big data, graph streams—continuous sequences of edges representing everything from network traffic to social media interactions—are growing at an astronomical rate. Storing these graphs in their entirety is often impossible, yet we need to query them in real-time to detect cyberattacks or track viral news. Researchers from Peking University have proposed a breakthrough solution: the Graph Stream Sketch (GSS).
TL;DR
The Graph Stream Sketch (GSS) is a novel data structure that summarizes massive, high-speed graph streams using linear space and constant update time. By combining compact "fingerprints" with a clever "square hashing" technique, GSS achieves orders of magnitude better accuracy than previous state-of-the-art methods while supporting a wide array of complex topological queries.
What Problem Does This Paper Address?
Traditional data structures like adjacency lists or matrices are too slow and memory-intensive for modern graph streams, which can involve millions of packets per second. To handle this, researchers use "sketches"—compact, lossy summaries of the data.
However, existing sketches face a major trade-off:
- Specialized sketches (like CM sketches) are accurate but only answer simple questions about edge weights; they can't handle structural queries like "can node A reach node B?"
- General-purpose graph sketches (like TCM or gMatrix) can answer structural queries but suffer from poor accuracy due to "hash collisions," where many different nodes are accidentally squashed into the same spot in memory.
The challenge is creating a summary that is small enough to fit in memory, fast enough to update in real-time, and accurate enough to be useful for complex graph algorithms.
Methods
GSS introduces several key innovations to break the speed-accuracy trade-off:
- Fingerprinting: Instead of just hashing nodes to a row or column in a matrix, GSS stores a "fingerprint" (a short bit-string) for each node. This allows the system to distinguish between different nodes that happen to hash to the same bucket.
- Square Hashing: Real-world graphs are "skewed"—a few "superstar" nodes have thousands of edges, while most have very few. In a standard matrix sketch, a superstar node would quickly overflow its assigned row. Square hashing allows an edge to be mapped to a sequence of $r \times r$ potential buckets, spreading the load and significantly reducing the need for an overflow buffer.
- Multiple Rooms: To optimize memory access, each bucket in the GSS matrix is divided into "rooms." This allows multiple edges to be stored in a single bucket, and the data is organized so that the system can check for an edge with a single memory access.
- Mapped Buckets Sampling: To keep update speeds high, GSS doesn't check every possible bucket for a new edge. Instead, it samples a small number of candidate buckets, ensuring constant-time updates ($O(1)$).
Datasets
The authors evaluated GSS using five diverse, real-world datasets:
- email-EuAll: A communication network from a European research institution.
- cit-HepPh: An Arxiv high-energy physics citation graph.
- web-NotreDame: A web graph of hyperlinks from Notre Dame University.
- lkml-reply: Communication records from the Linux kernel mailing list.
- Caida-networkflow: A massive dataset of Internet anonymized traffic traces.
Key Insights and Ideas
- The "Virtual" Graph Advantage: By using fingerprints, GSS effectively represents a much larger "virtual" graph sketch within the same physical memory footprint as its predecessors. This is why it can maintain high accuracy even when memory is extremely tight.
- Handling Skewness: The "square hashing" technique is a direct answer to the power-law distribution of graphs. By allowing edges to "overflow" into other rows and columns systematically, GSS prevents high-degree nodes from ruining the accuracy of the entire sketch.
- Hardware-Friendly Design: The "Multiple Rooms" approach is designed to minimize expensive memory lookups, ensuring that the "Fast" in the paper's title isn't just theoretical—it translates to millions of operations per second on standard hardware.
Key Results
The experimental results show that GSS is a significant leap forward:
- Superior Accuracy: GSS outperforms the state-of-the-art (TCM) by orders of magnitude. In many tests, GSS achieved near 100% precision, while TCM’s accuracy plummeted to near zero under the same memory constraints.
- Memory Efficiency: Even when given 256 times less memory than TCM, GSS still provided more accurate query results.
- High Throughput: GSS supports between 2.1 and 2.6 million insertions per second (MIPS), which is comparable to much simpler, less accurate sketches and significantly faster than traditional adjacency lists.
- Minimal Overflow: Thanks to square hashing, the overflow buffer (which is slower to search) typically stores less than 0.01% of the total edges.
Limitations and Future Work
While GSS is highly versatile, the authors note that its performance is most impressive on sparse graphs, which are common in real-world applications but not universal. The paper primarily focuses on directed graphs, though the authors mention the approach can be extended to undirected ones. Future work could involve integrating GSS into distributed graph processing frameworks like GraphX or PowerGraph to handle even larger-scale streaming data.
Reference: Xiangyang Gou, Lei Zou, Chenxingyu Zhao, Tong Yang. "Fast and Accurate Graph Stream Summarization." arXiv:1809.01246v1 [cs.DS], 2018.
Summary updated