Complexity of Computation of a Spanning Tree Enumeration Algorithm

Complexity of Computation of a Spanning Tree Enumeration Algorithm

IEEE TRANSACTIONSON CIRCUITS AND SYSTEMS,VOL. CAS-31, NO. lo, OCTOBER1984 853 Complexity of Computation of a Spanning Tree Enumeration Algorithm R. JAYAKUMAR, K. THULASIRAMAN, AND M. N. S. SWAMY, FELLOW, IEEE Absrracr -In l!X3, Char [4] presented an algorithm to enumerate all the rithm by minimizing the number of non-tree subgraphs spanning trees of an undirected graph G. This algorithm starts with a generated by the algorithm. Finally, in Section V, we known initial spanning tree of G, and generatesall the other spanning trees along with certain spanning non-tree subgraphs of G. In this paper a discuss a general technique called path compression,which detailed complexity analysis of char’s algorithm and methods to speed up can be used for an efficient implementation of Char’s the algorithm are discussed.Two heuristics for the selection of the initial algorithm to reduce the actual number of comparisons spanning tree are suggested. These heuristics result in a considerable made by the algorithm. reduction in the number of spanning non-tree subgraphs generated. A For graph theory terms and notation not defined here, technique called path compression, aimed at reducing the actual number of comparisons, is described. Computational results on several randomly see [6]. Without any loss of generality we also assumethat generated graphs are presented to illustrate the improvement achieved. the graphs considered in this paper are simple biconnected undirected graphs. I. INTRODUCTION II. CHAR'SALGORITHMTO ENUMERATEALLTHE NUMERATING all the spanning trees of a graph SPANNINGTREES E without duplication is one of the widely studied graph problems in Electrical Engineering and Computer Consider a connected undirected graph G = (V, E) with Scienceliterature. Since the number of spanning trees of a IZ= JV] vertices and m = ]E] edges.Let the vertices of G be graph increasesrapidly with the size of the graph, a highly denoted as 1,2; . 0, n. Let h = (DIGIT(l), DIGIT(2); . ., efficient algorithm is desired to enumerate all the spanning DIGIT(n - 1)) denote a (II - 1)-digit sequenceof vertices trees of a graph. Several algorithms of varying efficiency such that DIGIT is a vertex adjacent to vertex i in G. have been proposed in the literature. One of the well-known With each such sequence A we can associate a subgraph algorithms is due to Minty [l], which has been shown [2] to Gx = (V,, Eh) of G such that be of complexity O(m + n + mt), where m and II are the number of edges and the number of vertices of the graph, respectively, and t is the number of spanning trees of the and graph. Another efficient algorithm of complexity O(m + n E,= {(~,DIGIT(~)), (~,DIGIT(~)),..., + nt) is due to Gabow and Myers [3]. (n -l,DIGIT(n -1))). In 1968, Char [4] had presented a conceptually simple and elegant algorithm to enumerate all the spanning trees Char’s algorithm first performs a Breadth-First Search of a graph. However, Char had not presented a complexity [6] on G and finds a spanning tree called the initial analysis of his algorithm. The recent analysis of Char’s spanning tree. During this search,the vertices of G are also algorithm presented in [5] suggests that this algorithm renumbered as n, n - 1,. , 1 in the order in which they are might be the best of all the algorithms available so far for visited. Let h, = (REF(l), REF(2), * . , REF( n - 1)) be the the spanning tree enumeration problem. In this paper, we sequencecorresponding to this spanning tree. Starting with not only present a more detailed complexity analysis of h,, the algorithm enumeratesall the other spanning trees Char’s algorithm but also discuss different methods to of G by generating the sequencescorresponding to the further improve the speed of the algorithm. spanning trees of G. During this enumeration, the algo- In Section II we give a formal description of Char’s rithm also generatescertain sequenceswhich correspond to algorithm and summarise some of its interesting properties spanning non-tree subgraphs of G. The sequencescorre- reported in [5]. In Section III we give a detailed complexity sponding to spanning trees are referred to as tree sequences analysis of this algorithm and present several of its quanti- and those corresponding to spanning non-tree subgraphs tative and qualitative properties. In Section IV we develop are referred to as non-tree sequences.The sequenceh, is two heuristic procedures which help speed up Char’s algo- called the initial tree sequence. Char’s algorithm classifies a generatedsequence as a tree sequenceif it satisfies the following. Manuscriot received March 31. 1983: revised Seotember 6. 1983 and November 25 1983. This work was su’ ported by ihe Naturh Sciences and Enzineer& Research Council of 8 anada under Grant A-7739 and Tree Compatibility Property under &ant A-2680. The authors are with the Facult of En ‘neering and Computer Science, The sequence(DIGIT(l), DIGIT(2), * . , DIGIT( n - 1)) Concordia University, Montreal, S.Q., HTG lM8 Canada. represents a spanning tree of graph G if and only if 0098-4094/84/1000-0853$01.00 01984 IEEE 854 IEEE TRANSACTIONSON CIRCUITS AND SYSTEMS,VOL.CAS-31,N0. 10, OCTOBER1984 for each j 6 n -1 there exists, in G, a sequence of Theorem 1 edges (chosen from among the edges (1, DIGIT(l)), For a complete graph, the number to of spanning non-tree (2, DIGIT(2)); . , (n - 1, DIGIT(n - 1))) with subgraphs generatedby Char’s algorithm is independent of ( j, DIGIT( j)) as the starting edge, which leads to a vertex the initial spanning tree. cl k > j. 0 If a sequencedoes not have the above property, then it is Theorem 2 a non-tree sequence. Let G(“-i) be the set of all connected n-vertex graphs Char’s algorithm can be presentedin ALGOL-like nota- having at least one vertex of degree n - 1. For any graph tion as follows. G E G(“-l), to 6 t, if the initial spanning tree is a star tree. Char’s Algorithm to Enumerate all the Spanning Trees cl procedure CHAR; A characterization of each spanning non-tree subgraph comment The graph G is representedby the adjacency lists generatedby Char’s algorithm is also given in [5]. of its vertices. SUCC(DIGIT(i)) is the entry next to DIGIT(i) in the adjacency list of vertex i. III. COMPUTATIONAL COMPLEXITY OF CHAR'S begin ALGORITHM find the initial spanning tree and obtain the initial tree Since the computational complexity of Char’s algorithm sequenceX, = (REF(l), REF(2), . , REF( n - 1)); is O(m + n + n(t + to)), any complexity analysis of this renumber the vertices of the graph using the initial algorithm would require a study of the number (t + to). spanning tree; With this objective in view, we first obtain an expression initialize DIGIT(i):= REF(i), 1~ i G n - 1; for (t + to). output the initial spanning tree; Let k:=n -1; n-l while k f 0 do begin T= u q if SUCC(DIGIT(k)) # nil I=0 then begin DIGIT(k): = SUCC(DIGIT(k)); be the set of all the tree sequencessuch that if DIGIT(i), 1~ i 6 n - 1, is a tree sequence (i) To= {A,,}, and then begin / (ii) T., l<i<n - 1, is the set of all the tree sequencesof output the tree sequence; the form (DIGIT(l), DIGIT(2), * . , DIGIT(i), REF( i + l), k:=n -1 REF(i +2); * ., REF( n - 1)) with DIGIT(i) # REF( i). end Also let end n-1 else begin T’= u qr DIGIT(k): = REF( k); i=l k:=k -1 be the set of all the non-tree sequencessuch that q’ is the end set of all the non-tree sequencesof the form (DIGIT(l), end DIGIT(2), . , DIGIT(i), REF( i + l), REF( i + 2), * . , end CHAR; REF(n-1)) with DIGIT(i)#REF(i) for l<i<n--1. Given any sequence A = (DIGIT(l), DIGIT(2), . a, Note that JTI = t. Further, it follows from the characterisa- DIGIT(n - l)), Char’s algorithm obtains the next sequence tion of the non-tree subgraphs given in [5] that IT’1 = to. by changing DIGIT(k) in X. In the new sequence DIGIT(i) = REF(i) > i, k + 1~ i < n - 1, and DIGIT(l), Theorem 3 DIGIT(2), . , DIGIT( k - 1) have the same values as in Let G be a connected n-vertex undirected graph with its the previous sequence.Hence the new sequenceis to be vertices numbered as in Char’s algorithm. Let Gp), 1~ k tested for tree compatibility property only at position k < n - 1, be the graph obtained from G by coalescing the and this test, in the worst case,involves k - 1 comparisons. vertices k, k +l; . ., n and let t(k) be the number of Hence at most n computational steps are required to spanning trees of Gp). If t is the number of tree sequences generate and test a sequence.So, if to is the number of and to is the number of non-tree sequencesgenerated by non-tree sequencesand t is the number of tree sequences the algorithm, then generated by Char’s algorithm, in the worst case n(t + to) n-l computational steps are required to enumerate all the t + to =l+ c (deg(k)-l)t(k) spanning trees of the given graph and hence, Char’s algo- k=l rithm is of time complexity 0( m + n + n(t + to)), which where deg( k), 1~ k < n, is the degreeof vertex k in G.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us