Abstract
We present an algorithm to count the number of occurrences of a pattern graph H on h vertices as an induced subgraph in a host graph G. If G belongs to a bounded expansion class, the algorithm runs in linear time, if G belongs to a nowhere dense class it runs in almost-linear time. Our design choices are motivated by the need for an approach that can be engineered into a practical implementation for sparse host graphs. Specifically, we introduce a decomposition of the pattern H called a counting dag \(\vec {C}(H)\) which encodes an order-aware, inclusion-exclusion counting method for H. Given such a counting dag and a suitable linear ordering \(\mathbb {G}\) of G as input, our algorithm can count the number of times H appears as an induced subgraph in G in time \(O(\Vert \vec {C}\Vert \cdot h {\text {wcol}}_{h} (\mathbb {G})^{h-1} |G|)\), where \( {\text {wcol}}_{h} (\mathbb {G})\) denotes the maximum size of the weakly h-reachable sets in \(\mathbb {G}\). This implies, combined with previous results, an algorithm with running time \(O((3h^2 {\text {wcol}}_{h} (G))^{h^2} |G|)\) which only takes H and G as input. We note that with a small modification, our algorithm can instead use strongly h-reachable sets with running time \(O(\Vert \vec {C}\Vert \cdot h {\text {col}}_{h} (\mathbb {G})^{h-1} |G|)\), resulting in an overall complexity of \(O(h (3 {\text {col}}_{h} (G))^{h^2} |G|)\) when only given H and G. Because orderings with small weakly/strongly reachable sets can be computed relatively efficiently in practice (Nadara et al.: in J Exp Algorithmics 103:14:1–14:16, 2018), our algorithm provides a promising alternative to algorithms using the traditional p-treedepth coloring framework (O’Brien and Sullivan in: Experimental evaluation of counting subgraph isomorphisms in classes of bounded expansion, CoRR, arXiv:1712.06690, 2017). We describe preliminary experimental results from an initial open source implementation which highlight its potential.
Similar content being viewed by others
Notes
Since bounded expansion is a property of graph classes, this statement is of course not mathematically rigorous. See Sect. 5 for a brief discussion on this topic.
To be precise this data structure only uses fraternal augmentations.
Consider, for example, the graphs we need to count in order to compute the number of \(P_4\)s in a graph (Fig. 2). This list excludes e.g. \(K_4\).
We view these orderings as a type of graph decomposition and therefore assume they are part of the input. See the Preliminaries for a discussion on how a suitable ordering can be computed efficiently in theory and a discussion of practical approaches in Sect. 5.
These definitions could also be applied to tree-ordered graphs, but this does not bear any benefit here.
The algorithm relies on heavy machinery and is in its current formulation probably not practical. See Sect. 5 below for a discussion of this issue.
Code available under a BSD 3-clause license at http://www.github.com/theoryinpractice/mandoline.
References
Brown, C.T., Moritz, D., O’Brien, M.P., Reidl, F., Reiter, T., Sullivan, B.D.: Exploring neighborhoods in large metagenome assembly graphs using spacegraphcats reveals hidden sequence diversity. Genome Biol. 21(1), 1–16 (2020)
Chen, Y., Thurley, M., Weyer, M.: Understanding the complexity of induced subgraph isomorphisms. In: International Colloquium on Automata, Languages, and Programming, pp. 587–596. Springer, (2008)
Demaine, E.D., Reidl, F., Rossmanith, P., Sánchez Villaamil, F., Sikdar, S., Sullivan, B.D.: Structural sparsity of complex networks: bounded expansion in random models and real-world graphs. J. Comput. Syst, Sci (2019)
Dobler, A., Sorge, M., Villedieu, A.: Turbocharging heuristics for weak coloring numbers. In: 30th Annual European Symposium on Algorithms (ESA 2022), volume 244 of Leibniz International Proceedings in Informatics (LIPIcs), pp. 44:1–44:18. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2022)
Dvořák, Z.: Constant-factor approximation of the domination number in sparse graphs. Eur. J. Comb. 34(5), 833–840 (2013)
Dvořák, Z.: On weighted sublinear separators. J. Graph Theory 100(2), 270–280 (2022)
Dvořák, Z., Tůma, V.: A dynamic data structure for counting subgraphs in sparse graphs. In: Workshop on Algorithms and Data Structures, pp. 304–315. Springer (2013)
Eppstein, D., Löffler, M., Strash, D.: Listing all maximal cliques in sparse graphs in near-optimal time. In: International Symposium on Algorithms and Computation, pp. 403–414. Springer, (2010)
Farrell, M., Goodrich, T.D., Lemons, N., Reidl, F., Sánchez Villaamil, F., Sullivan, B.D.: Hyperbolicity, degeneracy, and expansion of random intersection graphs. In: Algorithms and Models for the Web Graph—12th International Workshop, WAW 2015, Eindhoven, The Netherlands, December 10–11, 2015, Proceedings, volume 9479 of Lecture Notes in Computer Science, pp. 29–41. Springer (2015)
Flum, J., Grohe, M.: The parameterized complexity of counting problems. SIAM J. Comput. 33(4), 892–922 (2004)
Flum, J., Grohe, M.: Parameterized Complexity Theory (Texts in Theoretical Computer Science. An EATCS Series). Springer, New York (2006)
Grohe, M., Kreutzer, S., Rabinovich, R., Siebertz, S., Stavropoulos, K.: Colouring and covering nowhere dense graphs. In: International Workshop on Graph-Theoretic Concepts in Computer Science, pp. 325–338. Springer (2015)
Grohe, M., Kreutzer, S., Siebertz, S.: Characterisations of Nowhere Dense Graphs (Invited Talk). In: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2013), volume 24 of Leibniz International Proceedings in Informatics (LIPIcs), pp. 21–40. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik (2013)
Kazana, W., Segoufin, L.: Enumeration of first-order queries on classes of structures with bounded expansion. In: Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pp. 297–308. ACM (2013)
Kierstead, H.A., Yang, D.: Orderings on graphs and game coloring number. Order 20(3), 255–264 (2003)
Knuth, D.E.: The Art of Computer Programming, Volume 1: Fundamental Algorithms, 3rd edn. Addison-Wesley, Boston (1997)
Nadara, W., Pilipczuk, M., Rabinovich, R., Reidl, F., Siebertz, S.: Empirical evaluation of approximation algorithms for generalized graph coloring and uniform quasi-wideness. J. Exp. Algorithmics 103, 14:1-14:16 (2018)
Nešetřil, J., de Mendez, P.O.: Grad and classes with bounded expansion I. Decompositions. Eur. J. Comb. 29(3), 760–776 (2008)
Nešetřil, J., Ossona de Mendez, P.: On nowhere dense graphs. Eur. J. Comb. 32(4), 600–617 (2011)
Nešetřil, J., de Mendez, P.O.: Sparsity: Graphs, Structures, and Algorithms, volume 28 of Algorithms and Combinatorics. Springer, New York (2012)
O’Brien, M.P., Sullivan, B.D.: Experimental evaluation of counting subgraph isomorphisms in classes of bounded expansion. CoRR, arXiv:1712.06690 (2017)
Reidl, F.: Structural sparseness and complex networks. Dr., Aachen, Techn. Hochsch., Aachen, Aachen, p. 2015. Hochsch., Diss, Techn (2016)
Ribeiro, P., Paredes, P., Silva, M.E.P., Aparicio, D., Silva, F.: A survey on subgraph counting: concepts, algorithms, and applications to network motifs and graphlets. ACM Comput. Surv. 54(2) (2021)
Zhu, X.: Colouring graphs with bounded generalized colouring number. Discrete Math. 309(18), 5562–5568 (2009)
Acknowledgements
We thank Marc Roth for pointing out a misattribution of parameterized hardness results in an earlier version of this paper. This work was supported in part by the Gordon & Betty Moore Foundation under award GBMF4560 to Blair D. Sullivan.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Reidl, F., Sullivan, B.D. A Color-Avoiding Approach to Subgraph Counting in Bounded Expansion Classes. Algorithmica 85, 2318–2347 (2023). https://doi.org/10.1007/s00453-023-01096-1
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-023-01096-1