English

Efficient Trace Frequency Queries in Sparse Graphs

Data Structures and Algorithms 2025-12-01 v1

Abstract

Understanding how a vertex relates to a set of vertices is a fundamental task in graph analysis. Given a graph GG and a vertex set XV(G)X \subseteq V(G), consider the collection of subsets of the form N(u)XN(u) \cap X where uu ranges over all vertices outside XX. These intersections, which we call the traces of XX, capture all ways vertices in GG connect to XX, and in this paper we consider the problem of listing these traces efficiently, and the related problem of recording the multiplicity (frequency) of each trace. For a given query set XX, both problems have obvious algorithms with running time O(N(X)X)O(|N(X)| \cdot |X|) and conditional lower bounds suggest that, on general graphs, one cannot expect better. However, in certain sparse graph classes, more efficient algorithms are possible: Drange \etal (IPEC 2023) used a data structure that answers trace queries in dd-degenerate graphs with linear initialisation time and query time that only depends on the query set XX and dd. However, the query time is exponential in X|X|, which makes this approach impractical. By using a stronger parameter than degeneracy, namely the strong 22-colouring number s2s_2, we construct a data structure in O(dG)O(d \cdot \|G\|) time, which answers subsequent trace frequency queries in time O((d2+s2d+2)X)O\big((d^2 + s_2^{d+2})|X|\big), where G\|G\| is the number of edges of GG, s2s_2 is the strong 22-colouring number and dd the degeneracy of a suitable ordering of GG. We demonstrate that this data structure is indeed practical and that it beats the simple, obvious alternative in almost all tested settings, using a collection of 217 real-world networks with up to 1.1M edges. As part of this effort, we demonstrate that computing an ordering with a small strong 22-colouring number is feasible with a simple heuristic.

Keywords

Cite

@article{arxiv.2511.22289,
  title  = {Efficient Trace Frequency Queries in Sparse Graphs},
  author = {Christine Awofeso and Pål Grønås Drange and Patrick Greaves and Oded Lachish and Felix Reidl},
  journal= {arXiv preprint arXiv:2511.22289},
  year   = {2025}
}