Counting and Sampling Labeled Chordal Graphs in Polynomial Time

Authors Úrsula Hébert-Johnson , Daniel Lokshtanov, Eric Vigoda

Thumbnail PDF


  • Filesize: 0.79 MB
  • 17 pages

Document Identifiers

Author Details

Úrsula Hébert-Johnson
  • University of California, Santa Barbara, CA, USA
Daniel Lokshtanov
  • University of California, Santa Barbara, CA, USA
Eric Vigoda
  • University of California, Santa Barbara, CA, USA

Cite AsGet BibTex

Úrsula Hébert-Johnson, Daniel Lokshtanov, and Eric Vigoda. Counting and Sampling Labeled Chordal Graphs in Polynomial Time. In 31st Annual European Symposium on Algorithms (ESA 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 274, pp. 58:1-58:17, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


We present the first polynomial-time algorithm to exactly compute the number of labeled chordal graphs on n vertices. Our algorithm solves a more general problem: given n and ω as input, it computes the number of ω-colorable labeled chordal graphs on n vertices, using O(n⁷) arithmetic operations. A standard sampling-to-counting reduction then yields a polynomial-time exact sampler that generates an ω-colorable labeled chordal graph on n vertices uniformly at random. Our counting algorithm improves upon the previous best result by Wormald (1985), which computes the number of labeled chordal graphs on n vertices in time exponential in n. An implementation of the polynomial-time counting algorithm gives the number of labeled chordal graphs on up to 30 vertices in less than three minutes on a standard desktop computer. Previously, the number of labeled chordal graphs was only known for graphs on up to 15 vertices.

Subject Classification

ACM Subject Classification
  • Theory of computation → Generating random combinatorial structures
  • Theory of computation → Graph algorithms analysis
  • Counting algorithms
  • graph sampling
  • chordal graphs


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


  1. Andrii Arman, Pu Gao, and Nicholas Wormald. Fast uniform generation of random graphs with given degree sequences. Random Structures & Algorithms, 59(3):291-314, 2021. Google Scholar
  2. EA Bender, LB Richmond, and NC Wormald. Almost all chordal graphs split. Journal of the Australian Mathematical Society, 38(2):214-221, 1985. Google Scholar
  3. Ivona Bezáková, Nayantara Bhatnagar, and Eric Vigoda. Sampling binary contingency tables with a greedy start. Random Structures & Algorithms, 30(1-2):168-205, 2007. Google Scholar
  4. Ivona Bezáková and Wenbo Sun. Mixing of Markov chains for independent sets on chordal graphs with bounded separators. In International Computing and Combinatorics Conference (COCOON), pages 664-676, 2020. Google Scholar
  5. Jean RS Blair and Barry Peyton. An introduction to chordal graphs and clique trees. In Graph theory and sparse matrix computation, pages 1-29. Springer, 1993. Google Scholar
  6. Manuel Bodirsky, Clemens Gröpl, and Mihyun Kang. Generating labeled planar graphs uniformly at random. Theoretical Computer Science, 379(3):377-386, 2007. Google Scholar
  7. Andreas Brandstädt, Van Bang Le, and Jeremy P Spinrad. Graph classes: a survey. SIAM, 1999. Google Scholar
  8. Tınaz Ekim, Mordechai Shalom, and Oylum Şeker. The complexity of subtree intersection representation of chordal graphs and linear time chordal graph generation. J. Comb. Optim., 41(3):710-735, 2021. Google Scholar
  9. Martin Farber. Independent domination in chordal graphs. Operations Research Letters, 1(4):134-138, 1982. Google Scholar
  10. Éric Fusy. Uniform random sampling of planar graphs in linear time. Random Structures & Algorithms, 35(4):464-522, 2009. Google Scholar
  11. Pu Gao and Nicholas Wormald. Uniform generation of random regular graphs. SIAM Journal on Computing, 46:1395-1427, 2017. Google Scholar
  12. Pu Gao and Nicholas Wormald. Uniform generation of random graphs with power-law degree sequences. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1741-1758, 2018. Google Scholar
  13. Fănică Gavril. Algorithms for minimum coloring, maximum clique, minimum covering by cliques, and maximum independent set of a chordal graph. SIAM Journal on Computing, 1(2):180-187, 1972. Google Scholar
  14. Martin Charles Golumbic. Algorithmic graph theory and perfect graphs. Elsevier, 2004. Google Scholar
  15. Catherine Greenhill. Generating graphs randomly, pages 133-186. London Mathematical Society Lecture Note Series. Cambridge University Press, 2021. Google Scholar
  16. Catherine Greenhill and Matteo Sfragara. The switch Markov chain for sampling irregular graphs and digraphs. Theoretical Computer Science, 719:1-20, 2018. Google Scholar
  17. Dan Gusfield. The multi-state perfect phylogeny problem with missing and removable data: Solutions via integer-programming and chordal graph theory. In Research in Computational Molecular Biology (RECOMB), pages 236-252, 2009. Google Scholar
  18. András Hajnal and János Surányi. Über die auflösung von graphen in vollständige teilgraphen. Ann. Univ. Sci. Budapest, Eötvös Sect. Math, 1:113-121, 1958. Google Scholar
  19. David Harvey and Joris Van Der Hoeven. Integer multiplication in time O(nlogn). Annals of Mathematics, 193(2):563-617, 2021. Google Scholar
  20. Pinar Heggernes. Minimal triangulations of graphs: A survey. Discrete Mathematics, 306(3):297-317, 2006. Google Scholar
  21. Mark Jerrum, Alistair Sinclair, and Eric Vigoda. A polynomial-time approximation algorithm for the permanent of a matrix with non-negative entries. Journal of the ACM, 51(4):671-697, 2004. Google Scholar
  22. Mark R. Jerrum, Leslie G. Valiant, and Vijay V. Vazirani. Random generation of combinatorial structures from a uniform distribution. Theoretical Computer Science, 43:169-188, 1986. Google Scholar
  23. Lilian Markenzon, Oswaldo Vernet, and Luiz Henrique Araujo. Two methods for the generation of chordal graphs. Annals of Operations Research, 157:47-60, 2008. Google Scholar
  24. Asish Mukhopadhyay and Md. Zamilur Rahman. Algorithms for generating strongly chordal graphs. In Transactions on Computational Science XXXVIII, pages 54-75, 2021. Google Scholar
  25. OEIS Foundation Inc. Entry A058862 in the On-Line Encyclopedia of Integer Sequences, 2023. Published electronically at URL:
  26. Yoshio Okamoto, Takeaki Uno, and Ryuhei Uehara. Counting the number of independent sets in chordal graphs. J. Discrete Algorithms, 6(2):229-242, 2008. Google Scholar
  27. Heinz Prüfer. Neuer beweis eines satzes über permutationen. Arch. Math. Phys, 27(1918):742-744, 1918. Google Scholar
  28. Teresa Przytycka, George Davis, Nan Song, and Dannie Durand. Graph theoretical insights into evolution of multidomain proteins. J Comput Biol., 13(2):351-363, 2006. Google Scholar
  29. H.N. de Ridder et al. Information system on graph classes and their inclusions (ISGCI)., 2016. Google Scholar
  30. Donald J Rose. A graph-theoretic study of the numerical solution of sparse positive definite systems of linear equations. In Graph theory and computing, pages 183-217. Elsevier, 1972. Google Scholar
  31. Donald J Rose, R Endre Tarjan, and George S Lueker. Algorithmic aspects of vertex elimination on graphs. SIAM Journal on computing, 5(2):266-283, 1976. Google Scholar
  32. Oylum Şeker, Pinar Heggernes, Tınaz Ekim, and Z. Caner Taşkın. Linear-time generation of random chordal graphs. In Proceedings of the 10th International Conference on Algorithms and Complexity (CIAC), pages 442-453, 2017. Google Scholar
  33. Wenbo Sun and Ivona Bezáková. Sampling random chordal graphs by MCMC (student abstract). In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34(10), pages 13929-13930, 2020. Google Scholar
  34. Marcel Wienöbst, Max Bannach, and Maciej Liśkiewicz. Polynomial-time algorithms for counting and sampling Markov equivalent DAGs. In The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI), pages 12198-12206, 2021. Google Scholar
  35. Nicholas C. Wormald. Counting labelled chordal graphs. Graphs and Combinatorics, 1:193-200, 1985. Google Scholar
  36. Nicholas C. Wormald. Generating random unlabelled graphs. SIAM Journal on Computing, 16(4):717-727, 1987. Google Scholar
  37. Mihalis Yannakakis. Computing the minimum fill-in is NP-complete. SIAM Journal on Algebraic Discrete Methods, 2(1):77-79, 1981. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail