11.07.2015 Views

Listing all the minimum spanning trees in an undirected graph

Listing all the minimum spanning trees in an undirected graph

Listing all the minimum spanning trees in an undirected graph

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

International Journal of Computer Ma<strong>the</strong>maticsVol. 87, No. 14, November 2010, 3175–3185<strong>List<strong>in</strong>g</strong> <strong>all</strong> <strong>the</strong> <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong> <strong>an</strong> <strong>undirected</strong> <strong>graph</strong>Takeo Yamada*, Seiji Kataoka <strong>an</strong>d Kohtaro Wat<strong>an</strong>abeDepartment of Computer Science, National Defense Academy, Yokosuka, K<strong>an</strong>agawa 239-8686, Jap<strong>an</strong>(Received 05 December 2008; revised version received 06 April 2009; second revision received 15 July 2009;accepted 06 September 2009 )Downloaded By: [Yamada, Takeo] At: 00:44 30 November 2010Efficient polynomial time algorithms are well known for <strong>the</strong> <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree problem. However,given <strong>an</strong> <strong>undirected</strong> <strong>graph</strong> with <strong>in</strong>teger edge weights, <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> may not be unique. Inthis article, we present <strong>an</strong> algorithm that lists <strong>all</strong> <strong>the</strong> <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong>cluded <strong>in</strong> <strong>the</strong> <strong>graph</strong>. Thecomputational complexity of <strong>the</strong> algorithm is O(N(mn + n 2 log n)) <strong>in</strong> time <strong>an</strong>d O(m) <strong>in</strong> space, wheren, m <strong>an</strong>d N st<strong>an</strong>d for <strong>the</strong> number of nodes, edges <strong>an</strong>d <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong>, respectively. Next, weexplore some properties of cut-sets, <strong>an</strong>d based on <strong>the</strong>se we construct <strong>an</strong> improved algorithm, which runs <strong>in</strong>O(Nm log n) time <strong>an</strong>d O(m) space. These algorithms are implemented <strong>in</strong> C l<strong>an</strong>guage, <strong>an</strong>d some numericalexperiments are conducted for pl<strong>an</strong>ar as well as complete <strong>graph</strong>s with r<strong>an</strong>dom edge weights.Keywords: <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree; enumeration algorithm2000 AMS Classifications: 05C05; 05C30; 68W051. IntroductionLet G = (V, E) be <strong>an</strong> <strong>undirected</strong> <strong>graph</strong> with vertex set V ={v 1 ,..., v n } <strong>an</strong>d edge set E ={e 1 ,...,e m }⊆V × V . Each edge e ∈ E is associated with <strong>an</strong> <strong>in</strong>teger weight w(e) > 0. Weassume that G is connected <strong>an</strong>d simple (i.e. <strong>the</strong>re exist nei<strong>the</strong>r self-loops nor multiple edges).A forest is <strong>an</strong> acyclic sub<strong>graph</strong> of G, <strong>an</strong>d a tree is a connected forest. For a tree T , its weightw(T ) is def<strong>in</strong>ed as <strong>the</strong> sum of <strong>the</strong> weights of constituent edges. A tree is a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree if itcovers <strong>all</strong> <strong>the</strong> nodes of G, <strong>an</strong>d a <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree is a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree with <strong>m<strong>in</strong>imum</strong> weight.Throughout <strong>the</strong> paper, this weight is denoted as z ⋆ , <strong>an</strong>d by MST we denote <strong>an</strong> arbitrary <strong>sp<strong>an</strong>n<strong>in</strong>g</strong>tree of this weight. (Later we consider <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong> some limited framework, where wemight have <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> with weights larger th<strong>an</strong> z ⋆ . Such a tree is not <strong>an</strong> MST <strong>in</strong> ourterm<strong>in</strong>ology.) Efficient algorithms are well known to f<strong>in</strong>d <strong>an</strong> MST <strong>in</strong> <strong>an</strong> <strong>undirected</strong> <strong>graph</strong> [1,6,10].However, <strong>the</strong>re may be more th<strong>an</strong> one MST, <strong>an</strong>d we are concerned with <strong>the</strong> follow<strong>in</strong>g problem.P : List <strong>all</strong> <strong>the</strong> MSTs <strong>in</strong> <strong>graph</strong> G.Related to this problem are <strong>the</strong> algorithms to list <strong>all</strong> <strong>the</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> [5,9,11], do <strong>the</strong> same <strong>in</strong>non-decreas<strong>in</strong>g order of cost [3,13] <strong>an</strong>d f<strong>in</strong>d K-shortest <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong> a <strong>graph</strong> [2,8]. Indeed,P may be solved by f<strong>in</strong>d<strong>in</strong>g <strong>all</strong> <strong>the</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong>, or more preferably by apply<strong>in</strong>g a K-shortest*Correspond<strong>in</strong>g author. Email: yamada@nda.ac.jpISSN 0020-7160 pr<strong>in</strong>t/ISSN 1029-0265 onl<strong>in</strong>e© 2010 Taylor & Fr<strong>an</strong>cisDOI: 10.1080/00207160903329699http://www.<strong>in</strong>formaworld.com


3176 T. Yamada et al.<strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree algorithm with sufficiently large K <strong>an</strong>d truncat<strong>in</strong>g its execution as soon as we havea <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree of weight larger th<strong>an</strong> z ⋆ . Unfortunately, <strong>the</strong> latter requires O(K) memory spacewhich is <strong>in</strong>feasible for problems with m<strong>an</strong>y MSTs. In this article, we give <strong>an</strong> algorithm, <strong>an</strong>d itsref<strong>in</strong>ement, that lists <strong>all</strong>, <strong>an</strong>d only, MSTs. These algorithms require O(m) space.2. A prototype enumeration algorithmDownloaded By: [Yamada, Takeo] At: 00:44 30 November 2010Let T ={e 1 ,...,e n−1 } be <strong>an</strong> arbitrary MST <strong>in</strong> G, which c<strong>an</strong> be obta<strong>in</strong>ed by <strong>an</strong>y st<strong>an</strong>dard MSTalgorithms. Then, follow<strong>in</strong>g <strong>the</strong> general scheme for solv<strong>in</strong>g enumeration problems <strong>in</strong> comb<strong>in</strong>atorialoptimization framework [4,7], we make use of this MST to divide P <strong>in</strong>to <strong>the</strong> follow<strong>in</strong>g setof mutu<strong>all</strong>y disjo<strong>in</strong>t subproblems (i = 1,...,n− 1).P({e 1 ,...,e i−1 }, {e i }) : List <strong>all</strong> <strong>the</strong> MSTs that conta<strong>in</strong> e 1 ,...,e i−1 , but do not conta<strong>in</strong> e i .More gener<strong>all</strong>y, for a forest F ={e 1 ,...,e k } <strong>in</strong> G <strong>an</strong>d a set of edges R ⊆ E that is disjo<strong>in</strong>twith F (i.e. F ∩ R =∅), a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree T is (F, R)-admissible if it conta<strong>in</strong>s <strong>all</strong> edges of F ,butdoes not conta<strong>in</strong> those of R. That is, T is (F, R)-admissible if <strong>an</strong>d only if F ⊆ T <strong>an</strong>d R ∩ T =∅.Here we use T to represent a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree, as well as <strong>the</strong> set of edges <strong>in</strong>cluded <strong>in</strong> that tree. F<strong>an</strong>d R are <strong>the</strong> sets of fixed <strong>an</strong>d restricted edges, respectively, <strong>an</strong>d we pose <strong>the</strong> follow<strong>in</strong>g problem.P(F,R) : List <strong>all</strong> <strong>the</strong> MSTs which are (F, R)-admissible.Clearly, P is identical to P(∅, ∅). We note that <strong>an</strong> (F, R)-admissible <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree of <strong>the</strong><strong>m<strong>in</strong>imum</strong> weight c<strong>an</strong> be easily obta<strong>in</strong>ed by slightly modify<strong>in</strong>g <strong>the</strong> st<strong>an</strong>dard MST algorithms. LetAn_MST(F, R) denote <strong>the</strong> algorithm to do this, that is it accepts F <strong>an</strong>d R as <strong>in</strong>puts <strong>an</strong>d returns <strong>an</strong>(F, R)-admissible <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree T ⋆ (F, R) of <strong>the</strong> <strong>m<strong>in</strong>imum</strong> weight z ⋆ (F, R). Kruskal’s or Prim’salgorithm [6,10] c<strong>an</strong> be easily tailored for this purpose. If no (F, R)-admissible <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> treeexists, we take <strong>the</strong> convention of writ<strong>in</strong>g z ⋆ (F, R) =∞.Then, if z ⋆ (F,R)>z ⋆ , no MST c<strong>an</strong> be (F, R)-admissible, <strong>an</strong>d hence we term<strong>in</strong>ate <strong>the</strong> subproblemP(F,R). O<strong>the</strong>rwise, we output T ⋆ (F, R) as <strong>an</strong> MST, <strong>an</strong>d make use of this tree to<strong>in</strong>troduce a set of subproblems <strong>in</strong> <strong>the</strong> follow<strong>in</strong>g way. Let k := |F | <strong>an</strong>d <strong>the</strong> tree be represented asT ⋆ (F, R) = F ∪{e k+1 ,...,e n−1 }.Fori = k + 1,...,n− 1, we def<strong>in</strong>eF i := F ∪{e k+1 ,...,e i−1 }, R i := R ∪{e i }. (1)Here, <strong>in</strong> case i = k + 1, we <strong>in</strong>terpret {e k+1 ,...,e i−1 }=∅<strong>an</strong>d F i = F . Then, P(F,R)is divided<strong>in</strong>to a set of mutu<strong>all</strong>y disjo<strong>in</strong>t subproblems P(F i ,R i )(i= k + 1,...,n− 1), <strong>an</strong>d <strong>the</strong> problem issolved if we solve <strong>all</strong> <strong>the</strong>se subproblems. Thus, a prototype algorithm c<strong>an</strong> be constructed <strong>in</strong> <strong>the</strong>divide <strong>an</strong>d conquer paradigm [12] as follows.Algorithm All_MST(F,R)Comment: F is a forest <strong>in</strong> G, R ⊆ E <strong>an</strong>d F ∩ R =∅.Step 1: Apply An_MST(F, R) to f<strong>in</strong>d T ⋆ (F, R) <strong>an</strong>d z ⋆ (F, R).Step 2: If z ⋆ (F,R)>z ⋆ , return.Step 3: Output T ⋆ (F, R), <strong>an</strong>d for i = k + 1,...,n− 1doDef<strong>in</strong>e (F i ,R i ) by (1), <strong>an</strong>d c<strong>all</strong> All_MST(F i ,R i ).endfor.Example 2.1 Consider <strong>the</strong> <strong>graph</strong> G of Figure 1, where edge weights are shown <strong>in</strong> italic. We startfrom P 0 := P(∅, ∅), <strong>an</strong>d obta<strong>in</strong> <strong>an</strong> MST with z ⋆ = 8 (Step 1). From P 0 , 5 children are generated(Step 3) as shown <strong>in</strong> Figure 2, <strong>an</strong>d <strong>in</strong> total we obta<strong>in</strong> 6 MSTs after exam<strong>in</strong><strong>in</strong>g 17 subproblems. Dueto <strong>the</strong> recursive nature of <strong>the</strong> algorithm, <strong>the</strong> subproblems are visited <strong>an</strong>d numbered <strong>in</strong> a depth-first


International Journal of Computer Ma<strong>the</strong>matics 3177Figure 1. Graph for Example 1.Downloaded By: [Yamada, Takeo] At: 00:44 30 November 2010Figure 2.Behaviour of All_MST.fashion. Here, <strong>the</strong> subproblems where MSTs are found are shaded with <strong>the</strong> correspond<strong>in</strong>g MSTshown at each shoulder. Details of <strong>the</strong> subproblems are summarized <strong>in</strong> Table 1. Here, <strong>in</strong> each rowwe show (F, R) that def<strong>in</strong>es subproblem P i , its parent,<strong>an</strong>(F, R)-admissible <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong>tree (if one exists) <strong>an</strong>d <strong>the</strong> correspond<strong>in</strong>g weight z ⋆ (F, R) of that tree. Underl<strong>in</strong>ed edges represent<strong>the</strong> set of newly fixed (resp. restricted) edges at each subproblem, which is denoted as F (resp.Table 1.Subproblems generated from All_MST.Subproblems Parent F R MST z ⋆ (F, R)P 0 – ∅ ∅ e 2 ,e 1 ,e 4 ,e 7 ,e 8 8P 1 P 0 ∅ e 2 – 9P 2 P 0 e 2 e 1 [e 2 ],e 5 ,e 4 ,e 7 ,e 8 8P 3 P 2 e 2 e 1 ,e 5 [e 2 ],e 6 ,e 7 ,e 4 ,e 9 8P 4 P 3 e 2 e 1 ,e 5 ,e 6 – 9P 5 P 3 e 2 ,e 6 e 1 ,e 5 ,e 7 – 10P 6 P 3 e 2 ,e 6 ,e 7 e 1 ,e 5 ,e 4 – 10P 7 P 3 e 2 ,e 6 ,e 7 ,e 4 e 1 ,e 5 ,e 9 [e 2 ,e 6 ,e 7 ,e 4 ],e 8 8P 8 P 7 e 2 ,e 6 ,e 7 , 4 4 e 1 ,e 5 ,e 9 ,e 8 – ∞P 9 P 2 e 2 ,e 5 e 1 ,e 4 – 10P 10 P 2 e 2 ,e 5 ,e 4 e 1 ,e 7 – 9P 11 P 2 e 2 ,e 5 ,e 4 ,e 7 e 1 ,e 8 [e 2 ,e 5 ,e 4 ,e 7 ],e 9 8P 12 P 11 e 2 ,e 5 ,e 4 ,e 7 e 1 ,e 8 ,e 9 – ∞P 13 P 0 e 2 ,e 1 e 4 – 9P 14 P 0 e 2 ,e 1 ,e 4 e 7 – 9P 15 P 0 e 2 ,e 1 ,e 4 ,e 7 e 8 [e 2 ,e 1 ,e 4 ,e 7 ],e 9 8P 16 P 15 e 2 ,e 1 ,e 4 ,e 7 e 8 ,e 9 – ∞


3178 T. Yamada et al.R) for later use. In <strong>the</strong> column ‘MST’, edges with<strong>in</strong> braces are <strong>the</strong> fixed edges, <strong>an</strong>d hyphen(-)shows that <strong>the</strong> subproblem is term<strong>in</strong>ated because z ⋆ (F,R)>z ⋆ .Downloaded By: [Yamada, Takeo] At: 00:44 30 November 2010The computational complexity of <strong>the</strong> above algorithm c<strong>an</strong> be evaluated as follows. Let Ndenote <strong>the</strong> number of MSTs <strong>in</strong>cluded <strong>in</strong> G, <strong>an</strong>d T MST (n, m) be <strong>the</strong> time required to solve <strong>an</strong> MSTproblem for a <strong>graph</strong> with n nodes <strong>an</strong>d m edges. Note that each subproblem, <strong>in</strong>clud<strong>in</strong>g <strong>an</strong> MST,produces at most n − 1 children. So <strong>the</strong> total number of subproblems generated <strong>in</strong> All_MST isat most Nn− N + 1 ≈ Nn. In each subproblem, we solve <strong>an</strong> MST problem, which requiresO(T MST (n, m)) time. Thus, <strong>the</strong> total time complexity is O(NnT MST (n, m)).To access <strong>the</strong> space complexity, consider <strong>the</strong> tree of subproblems as shown <strong>in</strong> Figure 2. Wenote that <strong>the</strong> maximum height of <strong>the</strong> tree is at most m, s<strong>in</strong>ce at each br<strong>an</strong>ch at least one edgeis ei<strong>the</strong>r fixed or restricted. While solv<strong>in</strong>g P(F,R), we only need to keep <strong>the</strong> differential <strong>in</strong>formation(F ′ ,R ′ ) <strong>in</strong> memory for <strong>all</strong> <strong>an</strong>cestors P(F ′ ,R ′ ) of P(F,R). From <strong>the</strong>se <strong>in</strong>cremental<strong>in</strong>formation, we c<strong>an</strong> reconstruct (F, R), <strong>an</strong>d to keep <strong>the</strong>se <strong>in</strong> memory O(m) space suffices. Thus,we have <strong>the</strong> follow<strong>in</strong>g.Theorem 2.2respectively.The time <strong>an</strong>d space complexities of All_MST are O(NnT MST (n, m)) <strong>an</strong>d O(m),Remark 2.3 A simple implementation of Kruskal’s algorithm [6] runs <strong>in</strong> T MST (n, m) = O(mn)time, but by us<strong>in</strong>g sophisticated data structure such as Fibonacci heap, this c<strong>an</strong> be improved toT MST (n, m) = O(m + n log n) [1]. Therefore, <strong>the</strong> time complexity of All_MST is3. A cut-set-based algorithmO(N(mn + n 2 log n)). (2)Let T be <strong>an</strong> MST of G, <strong>an</strong>d e <strong>an</strong> arbitrary edge of T . Delet<strong>in</strong>g e from T divides <strong>the</strong> tree <strong>in</strong>totwo connected components with vertexes sets, say V 1 <strong>an</strong>d V 2 . We <strong>in</strong>troduce <strong>the</strong> cut-set <strong>in</strong>ducedby e ∈ T as <strong>the</strong> set of edges with one endpo<strong>in</strong>t <strong>in</strong> V 1 <strong>an</strong>d <strong>the</strong> o<strong>the</strong>r <strong>in</strong> V 2 . If we def<strong>in</strong>e this asCut(e) := {e ′ ∈ E | e ′ ∈ (V 1 × V 2 ) ∪ (V 2 × V 1 )}, <strong>the</strong> follow<strong>in</strong>g Proposition is clear from <strong>the</strong> ‘cutoptimality condition’ [1, Theorem 13.1] for MST.Proposition 3.1Let T be <strong>an</strong> MST <strong>an</strong>d e ∈ T . Then, for <strong>an</strong> arbitrary edge e ′ ∈ Cut(e),w(e ′ ) ≥ w(e). (3)That is, e ∈ T is <strong>an</strong> edge of <strong>the</strong> <strong>m<strong>in</strong>imum</strong> weight <strong>in</strong> Cut(e). For a pair of edges e ∈ T <strong>an</strong>de ′ ∈ Cut(e)\{e}, T ∪{e ′ }\{e} def<strong>in</strong>es <strong>an</strong>o<strong>the</strong>r <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree, which is denoted as T ∪ e ′ \e forsimplicity. Let G (e) denote <strong>the</strong> <strong>graph</strong> obta<strong>in</strong>ed from G by delet<strong>in</strong>g e. We <strong>the</strong>n have <strong>the</strong> follow<strong>in</strong>g.Theorem 3.2 Let T be <strong>an</strong> MST, e∈ T <strong>an</strong>d e ′ ̸= e be second <strong>m<strong>in</strong>imum</strong> <strong>in</strong> weight <strong>in</strong> Cut(e).Then, T ′ := T ∪ e ′ \e is a <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree <strong>in</strong> G (e) .Proof Suppose that T ′ is not a <strong>m<strong>in</strong>imum</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree <strong>in</strong> G (e) . Then, by <strong>the</strong> ‘path optimalitycondition’[1, Theorem 13.3] <strong>the</strong>re exists a pair of edges c/∈ T ′ <strong>an</strong>d d ∈ T ′ such that (1) T ′′ := T ′ ∪c\d is a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree <strong>an</strong>d (2) w(c)


International Journal of Computer Ma<strong>the</strong>matics 3179Let <strong>the</strong> cycles <strong>in</strong>cluded <strong>in</strong> T ⋆ ∪{e ′ }, T ⋆ ∪{c} <strong>an</strong>d T ′ ∪{c} be C 0 , C 1 <strong>an</strong>d C 2 , respectively. S<strong>in</strong>ceC 2 = C 0 ⊕ C 1 (<strong>in</strong> Boole<strong>an</strong> sense) <strong>an</strong>d d ∈ C 2 ,wehaved ∈ C 0 or d ∈ C 1 . Def<strong>in</strong>e{TˆT ⋆ ∪ e ′ \d if d ∈ C 0 ,:=T ⋆ (5)∪ c\d if d ∈ C 1 .Then, ˆT is a <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> tree with w( ˆT)


International Journal of Computer Ma<strong>the</strong>matics 3183Table 4.Result of experiments (complete <strong>graph</strong>s, const<strong>an</strong>t edge weights).All − MST All − MST 1Graph N #sub CPU CPUK 3 3 6 0.00 0.00K 4 16 29 0.00 0.00K 5 125 212 0.00 0.00K 6 1296 2117 0.02 0.01K 7 16,807 26,830 0.22 0.08K 8 262,144 412,015 3.60 1.35K 9 4,782,969 7,433,032 60.74 26.99K 10 100,000,000 154,076,201 1694.27 616.10Downloaded By: [Yamada, Takeo] At: 00:44 30 November 2010Figure 5. Pl<strong>an</strong>ar <strong>graph</strong> P 100×260 .Table 4 gives <strong>the</strong> result of experiments for K n . The number of <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> (N), <strong>the</strong> number ofgenerated subproblems (#sub) <strong>an</strong>d CPU time <strong>in</strong> seconds are shown. BothAll_MST <strong>an</strong>dAll_MST 1compute N n correctly for n ≤ 10, <strong>an</strong>d All_MST 1 is approximately 2.5 times faster th<strong>an</strong> All_MST.5.2 Pl<strong>an</strong>ar <strong>graph</strong>s with r<strong>an</strong>dom edge weightsLet P n×m be a pl<strong>an</strong>ar <strong>graph</strong> with n nodes <strong>an</strong>d m edges (See Figure 5 for P 100×260 ), <strong>an</strong>d <strong>the</strong> edgeweights are both r<strong>an</strong>domly <strong>an</strong>d uniformly distributed over [1, 10 L ] (L = 2, 3).Table 5 summarizes <strong>the</strong> result of <strong>the</strong> experiments for <strong>the</strong>se <strong>graph</strong>s. Each row is <strong>the</strong> average of10 <strong>in</strong>dependent runs. In this case, All_MST 1 runs 30 – 60 times faster th<strong>an</strong> All_MST. The numberof MSTs is much sm<strong>all</strong>er <strong>in</strong> <strong>the</strong> case where edge weights are distributed over [1, 1000] (L = 3)th<strong>an</strong> <strong>in</strong> <strong>the</strong> case L = 2. This is expla<strong>in</strong>ed as follows. In <strong>the</strong> latter case, <strong>the</strong> ch<strong>an</strong>ce of hav<strong>in</strong>g edgesof identical weights are much larger th<strong>an</strong> <strong>in</strong> <strong>the</strong> former case.5.3 Complete <strong>graph</strong>s with r<strong>an</strong>dom edge weightsTable 6 gives <strong>the</strong> result for complete <strong>graph</strong>s with r<strong>an</strong>dom edge weights uniformly distributedover [1, 10 L ] (L = 2, 3). Aga<strong>in</strong> each row is <strong>the</strong> average of 10 <strong>in</strong>dependent runs. In this case,All_MST 1 is faster th<strong>an</strong> All_MST, but only 2–4 times, as opposed to 50–70 times <strong>in</strong> <strong>the</strong> caseof pl<strong>an</strong>ar <strong>graph</strong>s. This may be expla<strong>in</strong>ed by consider<strong>in</strong>g <strong>the</strong> ratio of <strong>the</strong> number of subproblemsgenerated <strong>in</strong> All_MST over <strong>the</strong> total number of MSTs (i.e. #sub/N <strong>in</strong> Tables 5 <strong>an</strong>d 6). For pl<strong>an</strong>ar<strong>graph</strong>s this ratio is approximately 20–50 <strong>in</strong> <strong>the</strong> case of L = 2 <strong>an</strong>d 100–500 for L = 3. Similarly,for complete <strong>graph</strong>s <strong>the</strong> ratio is 3–10 (L = 2) <strong>an</strong>d 10–40 (L = 3), respectively. Thus, <strong>the</strong> ratiois larger for pl<strong>an</strong>ar <strong>graph</strong>s th<strong>an</strong> for complete <strong>graph</strong>s, me<strong>an</strong><strong>in</strong>g that All_MST generates more


International Journal of Computer Ma<strong>the</strong>matics 3185AcknowledgementsThe authors are grateful to two <strong>an</strong>onymous referees <strong>an</strong>d <strong>an</strong>d a Editor for <strong>the</strong>ir constructive criticisms <strong>an</strong>d suggestions.Numerous comments from Professor Kazuo Ouchi were subst<strong>an</strong>tial <strong>in</strong> improv<strong>in</strong>g <strong>the</strong> quality of English <strong>in</strong> this paper, forwhich we express deep appreciation.ReferencesDownloaded By: [Yamada, Takeo] At: 00:44 30 November 2010[1] R.K. Ahuja, T.L. Magn<strong>an</strong>ti, <strong>an</strong>d J.B. Orl<strong>in</strong>, Network Flows: Theory, Algorithms, <strong>an</strong>d Applications, Prentice-H<strong>all</strong>,Englewood Cliffs, NJ, 1993.[2] P.M. Camer<strong>in</strong>i, L. Fratta, <strong>an</strong>d F. Maffioli, Efficient methods for r<strong>an</strong>k<strong>in</strong>g <strong>trees</strong>, Proceed<strong>in</strong>gs of <strong>the</strong> 3rd InternationalSymposium on Network Theory, Split, Yugoslavia, 1975, pp. 1–10.[3] H.N. Gabow, Two algorithms for generat<strong>in</strong>g weighted <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong> order, SIAM J. Comput. 6 (1977),pp. 139–150.[4] H.W. Hamacher <strong>an</strong>d M. Queyr<strong>an</strong>ne, K-best solutions to comb<strong>in</strong>atorial optimization problems, Ann. Oper. Res. 4(1985), pp. 123–143.[5] S. Kapoor <strong>an</strong>d H. Ramesh, Algorithms for enumerat<strong>in</strong>g <strong>all</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> of <strong>undirected</strong> <strong>an</strong>d weighted <strong>graph</strong>s, SIAMJ. Comput. 24 (1995), pp. 247–265.[6] J.B. Kruskal, On <strong>the</strong> shortest <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> subtree of a <strong>graph</strong> <strong>an</strong>d <strong>the</strong> travel<strong>in</strong>g salesm<strong>an</strong> problem, Proc. Am. Math.Soc. 7 (1956), pp. 8–50.[7] E.L. Lawler, A procedure for comput<strong>in</strong>g <strong>the</strong> K best solutions to discrete optimization problems <strong>an</strong>d its applicationto <strong>the</strong> shortest path problem, M<strong>an</strong>ag. Sci. 18 (1972), pp. 401–405.[8] T. Matsui, A flexible algorithm for generat<strong>in</strong>g <strong>all</strong> <strong>the</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> <strong>in</strong> <strong>undirected</strong> <strong>graph</strong>s, Algorithmica, 18 (1997),pp. 530–543.[9] G.J. M<strong>in</strong>ty, A simple algorithm for list<strong>in</strong>g <strong>all</strong> <strong>the</strong> <strong>trees</strong> of a <strong>graph</strong>, IEEE Tr<strong>an</strong>s. Circuit Theory CT-12 (1965), p. 120.[10] R.C. Prim, Shortest connection networks <strong>an</strong>d some generalizations, Bell Syst. Tech. J. 36 (1957), pp. 1389–1401.[11] R.C. Read <strong>an</strong>d R.E. Tarj<strong>an</strong>, Bounds on backtrack algorithms for list<strong>in</strong>g cycles, paths, <strong>an</strong>d <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong>, Networks5 (1975), pp. 237–252.[12] R. Sedgewick, Algorithms <strong>in</strong> C, 3rd ed., Addison-Wesley, Read<strong>in</strong>g, MA, 1998.[13] K. Sörensen <strong>an</strong>d G.K. J<strong>an</strong>ssens, An algorithm to generate <strong>all</strong> <strong>sp<strong>an</strong>n<strong>in</strong>g</strong> <strong>trees</strong> of a <strong>graph</strong> <strong>in</strong> order of <strong>in</strong>creas<strong>in</strong>g cost,Pesqui. Oper., 25 (2005), pp. 219–229.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!