Fully Dynamic Four-Vertex Subgraph Counting

Authors Kathrin Hanauer , Monika Henzinger , Qi Cheng Hua

Thumbnail PDF


  • Filesize: 1.1 MB
  • 17 pages

Document Identifiers

Author Details

Kathrin Hanauer
  • Faculty of Computer Science, University of Vienna, Austria
Monika Henzinger
  • Faculty of Computer Science, University of Vienna, Austria
Qi Cheng Hua
  • Faculty of Computer Science, University of Vienna, Austria


The authors want to thank Leonhard Paul Sidl for careful proofreading.

Cite AsGet BibTex

Kathrin Hanauer, Monika Henzinger, and Qi Cheng Hua. Fully Dynamic Four-Vertex Subgraph Counting. In 1st Symposium on Algorithmic Foundations of Dynamic Networks (SAND 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 221, pp. 18:1-18:17, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


This paper presents a comprehensive study of algorithms for maintaining the number of all connected four-vertex subgraphs in a dynamic graph. Specifically, our algorithms maintain the number of paths of length three in deterministic amortized O(m^{1/2}) update time, and any other connected four-vertex subgraph which is not a clique in deterministic amortized update time O(m^{2/3}). Queries can be answered in constant time. We also study the query times for subgraphs containing an arbitrary edge that is supplied only with the query as well as the case where only subgraphs containing a vertex s that is fixed beforehand are considered. For length-3 paths, paws, 4-cycles, and diamonds our bounds match or are not far from (conditional) lower bounds: Based on the OMv conjecture we show that any dynamic algorithm that detects the existence of paws, diamonds, or 4-cycles or that counts length-3 paths takes update time Ω(m^{1/2-δ}). Additionally, for 4-cliques and all connected induced subgraphs, we show a lower bound of Ω(m^{1-δ}) for any small constant δ > 0 for the amortized update time, assuming the static combinatorial 4-clique conjecture holds. This shows that the O(m) algorithm by Eppstein et al. [David Eppstein et al., 2012] for these subgraphs cannot be improved by a polynomial factor.

Subject Classification

ACM Subject Classification
  • Theory of computation → Graph algorithms analysis
  • Theory of computation → Dynamic graph algorithms
  • Dynamic Graph Algorithms
  • Subgraph Counting
  • Motif Search


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. If the current clique algorithms are optimal, so is valiant’s parser. SIAM Journal on Computing, 47(6):2527-2555, 2018. Google Scholar
  2. N. Alon, R. Yuster, and U. Zwick. Finding and counting given length cycles. Algorithmica, 17(3):209-223, March 1997. URL: https://doi.org/10.1007/BF02523189.
  3. Ziv Bar-Yossef, Ravi Kumar, and D. Sivakumar. Reductions in streaming algorithms, with an application to counting triangles in graphs. In Proceedings of the Thirteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '02, pages 623-632, USA, 2002. Society for Industrial and Applied Mathematics. Google Scholar
  4. Thiago Bergamaschi, Monika Henzinger, Maximilian Probst Gutenberg, Virginia Vassilevska Williams, and Nicole Wein. New techniques and fine-grained hardness for dynamic near-additive spanners. In Dániel Marx, editor, Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, Virtual Conference, January 10 - 13, 2021, pages 1836-1855. SIAM, 2021. URL: https://doi.org/10.1137/1.9781611976465.110.
  5. Karl Bringmann, Nick Fischer, and Marvin Künnemann. A fine-grained analogue of schaefer’s theorem in p: Dichotomy of ∃ k∀-quantified first-order graph properties. In 34th Computational Complexity Conference, pages 1-27. Schloss Dagstuhl, 2019. Google Scholar
  6. Luciana S. Buriol, Gereon Frahling, Stefano Leonardi, Alberto Marchetti-Spaccamela, and Christian Sohler. Counting triangles in data streams. In Proceedings of the Twenty-Fifth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS '06, pages 253-262, New York, NY, USA, 2006. Association for Computing Machinery. URL: https://doi.org/10.1145/1142351.1142388.
  7. Laxman Dhulipala, Quanquan C. Liu, Julian Shun, and Shangdi Yu. Parallel batch-dynamic k-clique counting. CoRR, abs/2003.13585, 2020. URL: http://arxiv.org/abs/2003.13585.
  8. Zdeněk Dvořák and Vojtěch Tůma. A dynamic data structure for counting subgraphs in sparse graphs. In Frank Dehne, Roberto Solis-Oba, and Jörg-Rüdiger Sack, editors, Algorithms and Data Structures, pages 304-315, Berlin, Heidelberg, 2013. Springer Berlin Heidelberg. Google Scholar
  9. David Eppstein, Michael T. Goodrich, Darren Strash, and Lowell Trott. Extended dynamic subgraph statistics using h-index parameterized data structures. Theor. Comput. Sci., 447:44-52, 2012. URL: https://doi.org/10.1016/j.tcs.2011.11.034.
  10. David Eppstein and Emma S. Spiro. The h-index of a graph and its application to dynamic subgraph statistics. J. Graph Algorithms Appl., 16(2):543-567, 2012. URL: https://doi.org/10.7155/jgaa.00273.
  11. Kathrin Hanauer, Monika Henzinger, and Qi Cheng Hua. Fully dynamic four-vertex subgraph counting. CoRR, abs/2106.15524, 2021. URL: http://arxiv.org/abs/2106.15524.
  12. Monika Henzinger, Sebastian Krinninger, Danupon Nanongkai, and Thatchaphol Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In Proceedings of the Forty-Seventh Annual ACM Symposium on Theory of Computing, pages 21-30, 2015. Google Scholar
  13. Monika Henzinger, Andrea Lincoln, and Barna Saha. The complexity of average-case dynamic subgraph counting. In Proceedings of the Thirty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, Alexandria, Virginia, USA, January 9-12, 2022. SIAM, 2022. to appear. Google Scholar
  14. Ahmet Kara, Hung Q. Ngo, Milos Nikolic, Dan Olteanu, and Haozhe Zhang. Counting Triangles under Updates in Worst-Case Optimal Time. In Pablo Barcelo and Marco Calautti, editors, 22nd International Conference on Database Theory (ICDT 2019), volume 127 of Leibniz International Proceedings in Informatics (LIPIcs), pages 4:1-4:18, Dagstuhl, Germany, 2019. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. URL: https://doi.org/10.4230/LIPIcs.ICDT.2019.4.
  15. Ahmet Kara, Hung Q. Ngo, Milos Nikolic, Dan Olteanu, and Haozhe Zhang. Maintaining triangle queries under updates. ACM Trans. Database Syst., 45(3):11:1-11:46, 2020. URL: https://doi.org/10.1145/3396375.
  16. T. Kloks, D. Kratsch, and H. Müller. Finding and counting small induced subgraphs efficiently. In Manfred Nagl, editor, Graph-Theoretic Concepts in Computer Science, pages 14-23, Berlin, Heidelberg, 1995. Springer Berlin Heidelberg. Google Scholar
  17. William L Kocay. Some new methods in reconstruction theory. In Combinatorial Mathematics IX, pages 89-114. Springer, 1982. Google Scholar
  18. Tamara G. Kolda, Ali Pinar, Todd Plantenga, C. Seshadhri, and Christine Task. Counting triangles in massive graphs with mapreduce. SIAM Journal on Scientific Computing, 36(5):S48-S77, 2014. URL: https://doi.org/10.1137/13090729X.
  19. F. Le Gall. Powers of tensors and fast matrix multiplication. In K. Nabeshima, K. Nagasaka, F. Winkler, and Á. Szántó, editors, International Symposium on Symbolic and Algebraic Computation, ISSAC '14, Kobe, Japan, July 23-25, 2014, pages 296-303. ACM, 2014. URL: https://doi.org/10.1145/2608628.2608664.
  20. Andrea Lincoln, Virginia Vassilevska Williams, and Ryan Williams. Tight hardness for shortest cycles and paths in sparse graphs. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1236-1252. SIAM, 2018. Google Scholar
  21. Siddhartha Sahu, Amine Mhedhbi, Semih Salihoglu, Jimmy Lin, and M. Tamer Özsu. The ubiquity of large graphs and surprising challenges of graph processing: extended survey. VLDB J., 29(2-3):595-618, 2020. URL: https://doi.org/10.1007/s00778-019-00548-x.