Abstract
Continuous pattern detection in dynamic graphs is a critical challenge in domains like network security and social media analysis. This paper presents an incremental algorithm for subgraph matching that leverages query decomposition and distributional statistics. By breaking complex queries into smaller primitives and organizing them in a Subgraph Join Tree (SJ-Tree), the proposed "Lazy Search" strategy prioritizes the most selective parts of a query. Experimental results on real-world and synthetic datasets demonstrate significant performance gains, achieving 10-100x speedups over traditional non-incremental methods.
Introduction
In the modern data landscape, information often arrives as a continuous stream of relationships—think of IP addresses communicating in a network or users interacting on social media. These are dynamic graphs. A common task is to find a specific "pattern of interest" (a subgraph) within this evolving mess.
The challenge is that finding a specific subgraph (the subgraph isomorphism problem) is NP-complete. Traditional approaches either re-run the query periodically—which is wasteful and slow—or try to index the entire graph, which is too expensive to maintain when edges are flying in at high speeds. This work introduces an algorithm that can detect these patterns as they emerge without drowning in computational overhead.
Methodology
The core of the optimization lies in three interconnected strategies: Query Decomposition, the SJ-Tree, and Lazy Search.
Query Decomposition
Instead of searching for a large, complex pattern all at once, the query graph is broken down into smaller "primitives," typically 1-edge or 2-edge subgraphs. This decomposition is guided by the vertex and edge types present in the stream.
The SJ-Tree (Subgraph Join Tree)
The algorithm utilizes a binary tree structure called the SJ-Tree. In this tree, the leaf nodes represent the small primitives identified during decomposition, while the internal nodes represent the "join" operations required to assemble these primitives back into the full pattern. The SJ-Tree maintains state by tracking partial matches over time, ensuring that the system only performs work when a new edge potentially completes a larger structure.
Lazy Search and Selectivity
The "Lazy Search" strategy is the primary optimization mechanism. Real-world graphs are rarely uniform; some relationships are common, while others are rare. The algorithm prioritizes searching for the most selective (rarest) parts of the query first. A search for the next part of the pattern is only triggered if a match for the previous, rarer part has already been found in that neighborhood.
To automate this, the researchers developed two metrics: Expected Selectivity and Relative Selectivity. These metrics allow the system to analyze the distribution of edges in the stream and automatically choose the most efficient decomposition strategy.
Experimental Evaluation
The approach was evaluated across three diverse, high-volume datasets:
- New York Times (NYT): A graph of articles and their facets (people, locations, organizations) collected over three months.
- Network Traffic (CAIDA): 22 million "netflow" records representing internet backbone traffic.
- LSBench (Linked Stream Benchmark): A synthetic RDF social media stream simulating 1 million users and their activities.
Key Results
The incremental approach demonstrated 10-100x speedups compared to the non-incremental VF2 algorithm. The "Lazy Search" variants (SingleLazy and PathLazy) consistently outperformed "track-everything" approaches, especially as query complexity increased.
The experiments also highlighted the importance of selectivity. On the NYT dataset, 1-edge decomposition (SingleLazy) performed best, while on the more complex LSBench data, 2-edge decomposition (PathLazy) was superior. This validates the use of Relative Selectivity metrics to adapt the strategy to the specific data distribution.
Conclusion
By exploiting the heterogeneity of real-world graph streams and employing stateful tracking via the SJ-Tree, this research makes real-time pattern detection feasible in high-throughput environments. Future work includes addressing distribution shifts where edge selectivity changes over time and incorporating specialized algorithms for complex substructures like triangles or cycles.
Summary updated