Abstract
Cameron et al. [27th Int. Conf. Computing and Combinatorics (COCOON 2021), LNCS 13025, pp. 49–60] recently presented an algorithm for generating all spanning trees of a fan graph in \(\mathcal {O}(1)\)-amortized time. The listing of spanning trees fulfills the so-called pivot Gray code property so that successive trees differ by pivoting a single edge around a vertex. They also presented algorithms for ranking and unranking a spanning tree in the listing in \(\mathcal {O}(n)\) time using \(\mathcal {O}(n)\) space. In this paper, we first observe that all spanning trees of a fan graph can be naturally represented by integer sequences so that their coding tree has properties with regularity. Then, we propose a simple algorithm for generating spanning-tree sequences in lexicographic order in \(\mathcal {O}(1)\)-amortized time according to these properties. Additionally, based on the lexicographic order, we develop ranking and unranking algorithms in \(\mathcal {O}(n)\)-time using \(n+\mathcal {O}(1)\) space (i.e., the size of the space is just slightly larger than n).
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsReferences
Bogdanowicz, Z.R.: Formulas for the number of spanning trees in a fan. Appl. Math. Sci. 2(16), 781–786 (2008)
Cameron, B., Grubb, A., Sawada, J.: A pivot gray code listing for the spanning trees of the fan graph. In: Chen, C.-Y., Hon, W.-K., Hung, L.-J., Lee, C.-W. (eds.) COCOON 2021. LNCS, vol. 13025, pp. 49–60. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-89543-3_5
Chakraborty, M., Chowdhury, S., Chakraborty, J., Mehera, R., Pal, R.K.: Algorithms for generating all possible spanning trees of a simple undirected connected graph: an extensive review. Complex Intell. Syst. 5(3), 265–281 (2019). https://doi.org/10.1007/s40747-018-0079-7
Chang, Y.-H., Wu, R.-Y., Lin, C.-K., Chang, J.-M.: A loopless algorithm for generating \((k, m)\)-ary trees in gray code order. Optim. Lett. 15(4), 1133–1154 (2021). https://doi.org/10.1007/s11590-020-01613-z
Colbourn, C.J., Day, R.P., Nel, L.D.: Unranking and ranking spanning trees of a graph. J. Algorithms 10(2), 271–286 (1989)
Colbourn, C.J., Myrvold, W.J., Neufeld, E.: Two algorithms for unranking arborescences. J. Algorithms 20(2), 268–281 (1996)
Datta, S., Chakraborty, S., Chakraborty, M., Pal, R.K.: Algorithm to generate all spanning tree structures of a complete graph. In: Balas, V.E., Hassanien, A.E., Chakrabarti, S., Mandal, L. (eds.) Proceedings of International Conference on Computational Intelligence, Data Science and Cloud Computing. LNDECT, vol. 62, pp. 169–184. Springer, Singapore (2021). https://doi.org/10.1007/978-981-33-4968-1_14
Eǧecioǧlu, Ö., Remmel, J.B., Williamson, S.G.: A class of graphs which has efficient ranking and unranking algorithms for spanning trees and forests. Int. J. Found. Comput. Sci. 15(4), 619–648 (2004)
Gabow, H.N., Myers, E.W.: Finding all spanning trees of directed and undirected graphs. SIAM J. Comput. 7(3), 280–287 (1978)
Golynski, A.: Optimal lower bounds for rank and select indexes. Theor. Comput. Sci. 387(3), 348–359 (2007)
Kapoor, S., Ramesh, H.: Algorithms for enumerating all spanning trees of undirected and weighted graphs. SIAM J. Comput. 24(2), 247–265 (1995)
Kapoor, S., Ramesh, H.: An algorithm for enumerating all spanning trees of a directed graph. Algorithmica 27(2), 120–130 (2000). https://doi.org/10.1007/s004530010008
Mäkinen, V., Navarro, G.: Rank and select revisited and extended. Theor. Comput. Sci. 387(3), 332–347 (2007)
Matsui, T.: A flexible algorithm for generating all the spanning trees in undirected graphs. Algorithmica 18(4), 530–543 (1997). https://doi.org/10.1007/PL00009171
Minty, G.J.: A simple algorithm for listing all the trees of a graph. IEEE Trans. Circuit Theory 12(1), 120 (1965)
Reddy, K.K.M., Renjith, P., Sadagopan, N.: Listing all spanning trees in Halin graphs - sequential and parallel view. Discrete Math. Algorithms Appl. 10(1), 1850005 (2018)
Remmel, J.B., Williamson, S.G.: Spanning trees and function classes. Electron. J. Comb. 9(1), R34 (2002)
Remmel, J.B., Williamson, S.G.: Ranking and unranking trees with a given number or a given set of leaves. arXiv:1009.2060v1
Shioura, A., Tamura, A., Uno, T.: An optimal algorithm for scanning all spanning trees of undirected graphs. SIAM J. Comput. 26(3), 678–692 (1997)
Wu, R.-Y., Chang, J.-M., Chang, C.-H.: Ranking and unranking of non-regular trees with a prescribed branching sequence. Math. Comput. Model. 53(5–6), 1331–1335 (2011)
Acknowledgments
This research was supported by the Ministry of Science and Technology of Taiwan under Grants MOST110-2221-E-262–002 (R.-Y. Wu) and MOST110-2221-E-141–004 (J.-M. Chang).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Wu, RY., Tseng, CC., Hung, LJ., Chang, JM. (2022). Generating Spanning-Tree Sequences of a Fan Graph in Lexicographic Order and Ranking/Unranking Algorithms. In: Ljubić, I., Barahona, F., Dey, S.S., Mahjoub, A.R. (eds) Combinatorial Optimization. ISCO 2022. Lecture Notes in Computer Science, vol 13526. Springer, Cham. https://doi.org/10.1007/978-3-031-18530-4_15
Download citation
DOI: https://doi.org/10.1007/978-3-031-18530-4_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-18529-8
Online ISBN: 978-3-031-18530-4
eBook Packages: Computer ScienceComputer Science (R0)