A FLEXIBLE ALGORITHM FOR GENERATING ALL THE SPANNING TREES IN UNDIRECTED GRAPHS TOMOMI MATSUI 3

Size: px
Start display at page:

Download "A FLEXIBLE ALGORITHM FOR GENERATING ALL THE SPANNING TREES IN UNDIRECTED GRAPHS TOMOMI MATSUI 3"

Transcription

1 A FLEXIBLE ALGORITHM FOR GENERATING ALL THE SPANNING TREES IN UNDIRECTED GRAPHS TOMOMI MATSUI 3 Abstract. In this paper, we propose an algorithm for generating all the spanning trees in undirected graphs. The algorithm requires O(n + m + n) time where the given graph has n vertices, m edges and spanning trees. For outputting all the spanning trees explicitly, this time complexity is optimal. Our algorithm follows a special rooted tree structure on the skeleton graph of the spanning tree polytope. The rule by which the rooted tree structure is traversed is irrelevant to the time complexity. In this sense, our algorithm is exible. If we employ the depth-rst search rule, we can save the memory requirement to O(n + m): A breadth-rst implementation requires as much as O(m + n) space, but when a parallel computer is available, this might have an advantage. When a given graph is weighted, the best-rst search rule provides a ranking algorithm for the minimum spanning tree problem. The ranking algorithm requires O(n + m + n) time and O(m + n) space when we have a minimum spanning tree. Key words. enumeration problem, spanning tree AMS(MOS) subject classications. 05A15, 05C05 1. Introduction. In this paper, we propose an algorithm which generates all the spanning trees explicitly in O(n + m + n) time where the given graph has n vertices, m edges and spanning trees. For outputting all the spanning trees explicitly, the time complexity is optimal. Our algorithm generates all the spanning trees by following 1-dimensional faces of the spanning tree polytope (the convex hull of the characteristic vectors of spanning trees). More precisely, our algorithm traverses a tree structure (a rooted spanning tree) on the skeleton graph of the spanning tree polytope. From the above, our algorithm can be considered as a specialization of the reverse search method proposed by Avis and Fukuda [4], which is a general scheme for solving enumeration problems. Our algorithm has an advantage in that the tree search rule by which we traverse the tree structure on the skeleton graph is irrelevant to the time complexity. Thus, one can easily construct various algorithms with O(n + m + n) time complexity by using dierent tree search rules. In this sense, our algorithm is exible. For example, employing the depth-rst search rule we obtain an algorithm whose space complexity is O(n + m): A breadth-rst implementation requires as much as O(m + n) space, but when a parallel computer is available, this might have an advantage. One can even combine the two tree search rules to construct an algorithm which runs parallel but requires a xed amount of memory storage. When a weighted graph is given, our algorithm generates all the spanning trees in nondecreasing order of weight by employing best-rst search rule. The ranking algorithm requires O(n+m+ n) time and O(m+n) space when we have a minimum spanning tree. 3 Department of Mathematical Engineering and Information Physics, Faculty of Engineering, University of Tokyo, Bunkyo-ku, Tokyo 113, Japan. tomomi@misojiro.t.u-tokyo.ac.jp 1

2 In our algorithm, we do not require any specialized data structure, but a preprocedure plays an important role. In the pre-procedure, we partition all the edges into a specialized set of forests by employing the algorithm proposed by Nagamochi and Ibaraki [21] for generating a sparse k-connected graph. Based on this set of forests, we eciently decide the order of edges to exchange. From this point of view, we can say that our algorithm provides an application of the labeling technique of Nagamochi and Ibaraki. 2. Preliminally Results. This paper considers a problem for nding all the spanning trees in undirected graphs. The spanning tree enumeration problem has a long history and a lot of algorithms have been proposed (e.g., [18, 19, 27]). In 1975, Read and Tarjan presented a polynomial time delay algorithm by using a technique called backtracking [23]. Their algorithm requires O(n+m+ m) time and O(n+ m) space. In [13], Gabow and Myers rened the backtracking approach and obtained an algorithm with O(n+ m+n) time and O(n+m) space. For outputting all the spanning trees explicitly, this algorithm is optimal. Recently, Kapoor and Ramesh [14] and Shioura and Tamura [24] presented ecient algorithms for scanning all the spanning trees, which require O(n + m + ) time and O(nm) space. In [25], Shioura, Tamura and Uno proposed an optimal scanning algorithm for this problem which requires O(n + m + ) time and O(n + m) space. The above scanning algorithms output a list of spanning trees in compact form. More precisely, these algorithms output the relative dierence of each consecutive two spanning trees rather than the sequence of entire spanning trees. When a weighted graph is given, there exist many algorithms for nding a spanning tree whose weight is minimized [10, 12, 16, 17, 22, 28]. The minimum spanning tree problem appears as a subproblem in algorithms for routing problems and network design problems. In some application settings, a minimum spanning tree satisfying some constraints may be required. One possible approach for this problem is to generate all the spanning trees in nondecreasing order of weight until one satisfying the additional constraints is obtained. There exist some algorithms which generate spanning trees in nondecreasing order of weight [6, 9, 11, 14, 15, 20]. In [14], Kapoor and Ramesh proposed an algorithm for ranking all the spanning trees which requires O(nm + log n) time and O(nm + ) space. Recently, Eppstein, Galil, Italiano and Nisenzweig [8] developed the sparsication technique and proposed an algorithm for generating k smallest spanning trees in compact form which requires O(n + m log n + k p n log(m=n)) time. 3. Main Framework. In this section, we give some denitions and describe the main framework of our algorithm. Let us consider an undirected graph G = (V; E) with the vertex-set V and the edgeset E: In this paper, we assume that the graph G is connected and it contains neither self-loops nor parallel edges. We denote jv j by n and jej by m: For any edge-subset F E; the graph (V; F ) is called a spanning subgraph of G: A spanning subgraph (V; F ) of G is called a forest of G when the graph (V; F ) does not contain any cycle. A connected forest is called a spanning tree. Without loss of generality, we present a forest as its edge-set. Throughout this paper, we denote the set of all the spanning trees of G 2

3 by T and jt j by : For any spanning tree T and for any edge f 62 T; Cycle(T; f) E denotes the unique cycle in (V; T [ ff g): For any edge g 2 T; the graph (V; T n fgg) contains exactly two components. Thus the set of edges in E connecting these two components becomes a cut-set and we denote the cut-set by Cut(T; g): Throughout this paper, we assign a linear ordering on the edge-set by setting E = fe 1 ; e 2 ; : : : ; e m g: For any edge e j ; we say that the index of the edge e j is j: We denote the index of an edge e by index(e): Given an edge-subset E 0 E; the edge in E 0 with the smallest index is called the top edge of E 0 and denoted by top(e 0 ): Similarly, we call the edge in E 0 with the largest index the bottom edge of E 0 and denote the edge by btm(e 0 ): For any pair of edge-subsets E 0 and E 00 ; we say E 0 is lexicographically greater than E 00 ; denoted by E 0 > lex E 00 or E 00 < lex E 0 ; when there exists an integer j satisfying that (1) for any k with 0 k < j m; e k 2 E 0 if and only if e k 2 E 00 and (2) E 0 3 e j 62 E 00 : In the rest of this paper, we assume that the following property holds Assumption 3.1. The edge-subset T 3 = fe 1 ; e 2 ; : : : ; e n01 g is a spanning tree of G: Clearly, T 3 is the lexicographically maximum spanning tree of G. For any spanning tree T 0 dierent from T 3 ; (T 0 ) denotes the spanning tree (T 0 n ffg) [ fgg where f is the bottom edge of T 0 and g is the top edge of the cut-set Cut(T 0 ; f): Especially, we dene that (T 3 ) = T 3 : Lemma 3.2. Let T 0 be a spanning tree satisfying T 0 6= T 3 : If (T 0 ) = (T 0 nffg)[fgg; then g 2 T 3 63 f: Proof. The denition of implies that the edge g is the top edge of Cut(T 0 ; f); where f is the bottom edge of T 0 : From Assumption 3.1, it is clear that f 62 T 3 : Since T 3 is a spanning tree, Cut(T 0 ; f) \ T 3 6= ; and the index of g is less than or equal to the index of the bottom edge of T 3 : Then, Assumption 3.1 implies that g 2 T 3 : The proof of the above lemma implies that j(t 0 ) \ T 3 j = jt 0 \ T 3 j + 1: Then for any spanning tree T 0 dierent from T 3 ; it is clear that n01 (T 0 ) = T 3 : Given a spanning tree T 0 (6= T 3 ); we say T 0 is a child of (T 0 ) and (T 0 ) is the parent of T 0 : Then, we can construct a tree structure, denoted by (T ; ); with the node set T and the arc set f(t; T 0 ) 2 T 2 (T n ft 3 g) j T = (T 0 )g: Clearly, the spanning tree T 3 corresponds to the root of this tree structure. Our algorithm traverses this tree structure by using a suitable tree search rule and outputs all the spanning trees of the graph G: 4. Finding All the Children. In this section, we propose a procedure for nding all the children of a spanning tree Naive Algorithm. Given a spanning tree T of G; we say that an edge f is a pivot edge of T; if there exists a child T 0 of T such that T 0 n T = ffg: We should notice that a pivot edge f of T satises (T 0 ) = T 63 f 2 T 0 : Let T 0 = (T nfgg)[ffg be a child of T: From the denition of the parent-children relation, the edge g is the top edge of Cut(T 0 ; f): Since Cut(T 0 ; f) = Cut(T; g); g is also the top edge of Cut(T; g): We denote the edge-subset fe 0 2 T j e 0 is the top edge of Cut(T; e 0 )g by H(T): Then, g 2 H(T ) and the pivot edge f of T joins two dierent components of the graph (V; T n H(T )): Now we give an essential characterization of the pivot edges. 3

4 Lemma 4.1. Let T be a spanning tree of G: An edge f is a pivot edge of T if and only if f satises the conditions that (1) the index of f is greater than the index of the bottom edge of T; and (2) the edge f joins a pair of distinct components of the graph (V; T n H(T )): Proof. When f is a pivot edge, it is clear that f satises the above two conditions. Conversely, suppose that the edge f satises above two properties. It is obvious that Cycle(T; f)\h(t ) 6= ;: Let g be an edge in Cycle(T; f)\h(t ): Clearly, the edge-subset T 0 = (T n fgg) [ ff g is a spanning tree of G: From the condition (1), f is the bottom edge of the spanning tree T 0 : Since g 2 H(T ) and Cut(T; g) = Cut(T 0 ; f); g is the top edge of Cut(T; g) = Cut(T 0 ; f): Thus, T is the parent of T 0 and so f is a pivot edge of T: Now, consider the following problem. label((v; T ); H) input: a spanning tree (V; T) with a vertex-set V and an edge-set T; and an edge-subset H T: output: labels of vertices satisfying that two vertices have same labels if and only if they are connected in the graph (V; T n H) When vertex labels are obtained by solving the problem label((v; T ); H(T)), it is clear that an edge f satisfying index(f) > index(btm(t )) is a pivot edge of T if and only if the end vertices of f have dierent labels. Thus, for each edge f; we can check whether f is a pivot edge or not in O(1) time on referring to the vertex labels. When we have a pivot edge f of a spanning tree T; the following lemma gives an idea for nding all the children of T with bottom edge f: Lemma 4.2. Let T be a spanning tree of G and f be a pivot edge of T: An edge-subset T 0 = (T n fgg) [ ffg is a child spanning tree of T if and only if g 2 Cycle(T; f) \ H(T): Proof. Let g be an edge in Cycle(T; f) \ H(T ): Since g 2 Cycle(T; f); the edgesubset T 0 = (T n fgg) [ ffg is a spanning tree and Cut(T; g) = Cut(T 0 ; f): Since g 2 H(T ); g is the top edge of Cut(T; g) = Cut(T 0 ; f) and it implies that T is the parent of T 0 : The only if part is easy. Now we outline a naive algorithm for generating all the children of a spanning tree T: Here we assume that we have the edge set H(T): At rst, we solve the problem label((v; T ); H(T )). Next, we nd all the pivot edges of T by comparing the end vertices of every edge whose index is larger than that of the bottom edge of T: When a pivot edge f is obtained, we construct the edge-subset Cycle(T; f) \ H(T) and output the spanning tree (T n fgg) [ ffg for every edge g 2 Cycle(T; f) \ H(T ): Although the above algorithm nds all the children exactly, it is not so ecient. In the worst case, the algorithm checks O(m 0 n + 1) edges and nds that the spanning tree T has no child. In the next subsection, we give an idea for nding all the pivot edges eciently. 4

5 4.2. Finding All the Pivot Edges. In the rest of this section, we assume that the given graph G = (V; E) and its edges E = (e 1 ; e 2 ; : : : ; e m ) satisfy the following condition. Assumption 4.3. There exists a sequence of integers (j 0 ; j 1 ; : : : ; j r ) satisfying that (1) 0 = j 0 < j 1 < < j r = m; and (2) the edge partition (F 1 ; F 2 ; : : : ; F r ); where F s = fe js01+1; e js01+2; : : : ; e js g; satises the conditions that F 1 is a maximal forest of G and: 8s 2 f2; : : : ; rg; F s is a maximal forest of the graph (V; E n (F 1 [ F 2 [ [ F s01 )): Since the given graph G = (V; E) is connected, the forest F 1 is a spanning tree of G and so the edge indices satisfying the above assumption also satisfy Assumption 3.1. In the paper [21], Nagamochi and Ibaraki proposed an O(n + m) time algorithm for nding a partition (F 1 ; F 2 ; : : : ; F r ) of the edge-set E which satises the above condition. Thus, when we employ their algorithm as a pre-procedure, we can assign the integer numbers f1; 2; : : : ; mg to E so that Assumption 4.3 holds. The above assumption directly implies the following property. Claim 4.4. For any edge fu; vg 2 F s ; the vertices u and v are connected in the graph (V; F s01 ): From the above claim, we can show the following. Lemma 4.5. Let T be a spanning tree of G and k the index of the bottom edge of T: For any pivot edge f of T; either index(f) k + 2n 0 3 or there exists a pivot edge f 0 satisfying the condition that index(f) 0 2n + 3 index(f 0 ) < index(f): Proof. Let f = fu; vg be a pivot edge of T: Suppose that index(f) > k + 2n 0 3: Let F s be the forest (dened in the Assumption 4.3) containing the edge f: Then the forest F s01 satises that; index(top(f s01 )) = index(btm(f s )) jf s j 0 jf s01 j index(f) (n 0 1) > k: So, the index of every edge in F s01 is greater than that of the bottom edge of T: From Claim 4.4, there exists a path P in the graph (V; F s01 ) connecting the end vertices u and v of f: Since f is a pivot edge, u and v are not connected in the graph (V; T n H(T )): Thus the path P contains an edge f 0 which joins a pair of distinct components in the graph (V; T n H(T)): Since the index of the edge f 0 is greater than the index of the bottom edge of T; Lemma 4.1 implies that f 0 is also a pivot edge of T: From the fact that f 0 2 F s01 and f 2 F s ; it is clear that index(f) 0 2n + 3 index(f 0 ) < index(f): The above lemma gives an algorithm for nding all the pivot edges eciently. Denote the bottom edge of the current spanning tree T by e k : In our algorithm, we compare the labels of two end vertices of the edges (e k+1 ; e k+2 ; : : : ; e m ) in this order. When consecutive 2n 0 3 edges are not pivot edges, we can stop nding pivot edges Algorithm for Finding All the Children. Now we describe an algorithm for nding all the children. In the previous sub-sections, we discussed a method for nding all the children of a spanning tree T 0 under the assumption that the edge-subset 5

6 H(T 0 ) is obtained. In our algorithm, we construct the edge-subset H(T 0 ) together with T 0 at the time instance when the spanning tree T 0 is generated. The following lemma gives an idea to obtain H(T 0 ) eciently. Lemma 4.6. Let T be a spanning tree of G and T 0 = (T n fgg) [ ff g a child of T: Then, H(T 0 ) = H(T) n fe 0 2 Cycle(T; f) \ H(T ) j index(e 0 ) index(g)g Proof. Clearly, T 0 \ T 3 = (T \ T 3 ) n fgg: Case (1): Let e 0 be an edge in (T 0 \ T 3 ) n (Cycle(T; f)): Then Cut(T; e 0 ) = Cut(T 0 ; e 0 ); and so e 0 2 H(T 0 ) if and only if e 0 2 H(T ): Case (2): Let e 0 be an edge in (T 0 \ T 3 ) \Cycle(T; f): Then it is clear that Cut(T 0 ; e 0 ) = Cut(T; e 0 ) 4 Cut(T; g); where 4 denotes the symmetric dierence. Case (2-i): Suppose that e 0 62 H(T ): Denote the top edge of Cut(T; e 0 ) by e 00 : When e 00 2 Cut(T; g); then index(g) < index(e 00 ) < index(e 0 ); g 2 Cut(T 0 ; e 0 ); and so e 0 62 H(T 0 ): If e Cut(T; g); then index(e 00 ) < index(e 0 ); e 00 2 Cut(T 0 ; e 0 ); and we have e 0 62 H(T 0 ): Therefore, if e 0 2 (T 0 \ T 3 ) \ Cycle(T; f) and e 0 62 H(T); then e 0 62 H(T 0 ): Case (2-ii): Consider the case that e 0 2 H(T ): Clearly, e 0 = top(cut(t; e 0 )) and g = top(cut(t; g)): It implies that the top edge of Cut(T 0 ; e 0 ) is either e 0 or g: Thus, e 0 is the top edge of Cut(T 0 ; e 0 ) if and only if index(e 0 ) < index(g): Summarizing the above, we obtain the required result. The above lemma says that if T 0 is a child of a spanning tree T; then H(T 0 ) H(T): Now we describe our algorithm. Algorithm A input: a spanning tree T and the edge-subset H = H(T ) output: set of pairs f(t 0 ; H(T 0 )) j T 0 is a child of T g A1: begin A2: solve the problem label((v; T ); H); A3: set k := index(btm(t )); set j 0 := k; set j := k + 1; A4: while j minfj 0 + 2n 0 3; mg do A5: begin A6: if labels of two ends of e j are same then set j := j + 1; A7: else A8: begin A9: set f := e j ; set j 0 := j; set j := j + 1; set D := Cycle(T; f) \ H; A10: for g 2 D do A11: begin A12: set T 0 := (T n fgg) [ ffg; A13: set H 0 := H n fe 0 2 D j index(e 0 ) index(g)g; A14: output (T 0 ; H 0 ); A15: end; A16: end; A17: end; A18: end Now, we discuss the time complexity of the above algorithm. In our algorithm, we maintain the current spanning tree T by the adjacency list of the graph (V; T ): 6

7 Then, for any pair of vertices, we can nd a unique path in T connecting the pair in O(n) time by employing an ordinary tree search algorithm [26]. For each edge e of the current spanning tree T; we assume that we can check whether e 2 H or e 62 H in O(1) time. For example, it is accomplished by a 1-dimensional array indexed by the edges T 3 which represents the characteristic vector of H: Then, a tree search algorithm solves the problem label((v; T ); H) in O(n) time and nds the set Cycle(T; f) in O(n) time. Thus, the time complexity of every line in the above algorithm is bounded by O(n): Especially, Lines A4 and A6 require O(1) time. Let 0 be the number of children of T: Lemma 4.5 says that Lines A4 and A6 are executed at most (2n 0 3)( 0 + 1) times. All the other lines are executed at most 0 times. From the above, the overall time complexity becomes O(n + m + 0 n): Clearly, the memory requirement is bounded by O(n + m): 4.4. Implementation. In this subsection, we give some ideas which are useful for practical implementations. When we have the lexicographically minimum spanning tree, we can nd the pivot edge with the largest index in O(n) time by using the following property. Lemma 4.7. Let T be a spanning tree with at least one child. Then the pivot edge of T with the largest index is contained in the lexicographically minimum spanning tree of G: Proof. Let f be the pivot edge of T with the largest index. Then there exists an edge g in Cycle(T; f) \ H(T): Clearly, f is the bottom edge of the cut-set Cut(T; g): For any cut-set C 0 E; the bottom edge of C 0 is contained in the lexicographic minimum spanning tree. Thus f is contained in the lexicographically minimum spanning tree. The above lemma implies that when we check the edges in the lexicographically minimum spanning tree, we can nd the pivot edge of T with the largest index in O(n) time. Let e l be the pivot edge of the current spanning tree with the largest index and e k the bottom edge of the current spanning tree. Then, in Algorithm A, we can apply the `pivot edge test' for each edge in fe k+1 ; e k+2 ; : : : ; e l g in any order without increasing the time complexity. When we use a parallel computer, we can apply the above pivot edge tests independently. In addition, we can construct an enumeration type algorithm for the minimum spanning tree problem with additional constraints by choosing an appropriate pivot edge heuristically. At Line A10 in Algorithm A, we choose the edge g from D in arbitrary order. However, when we choose the edge g in the order that the index of the edge g is decreasing, we can save the computational eorts in practice. First, we can construct the edge set H 0 at Line A13 easily. Since we choose the edge g in decreasing order, the edge subset H 0 is obtained by deleting the edge g from the edge subset H 0 of previous iteration. Thus, we can modify Algorithm A by inseting the line A9-1: set H 0 := H; just before Line A10 and replacing Line A13 by A13: set H 0 := H 0 n fgg;. Next, we can eciently construct the vertex labels of every child T 0 without solving 7

8 the problem label((v; T 0 ); H(T 0 )). Assume that a pivot edge f is xed. If we construct the child T 0 = (T n fgg) [ ffg for each edge g 2 D in the order that the index of the edge g is decreasing, then the components of the graph (V; T 0 n H(T 0 )) are merged one by one. So, we can employ the data structure for disjoint sets (see [7] Section 22 for example). In the above modication, we can choose the edge g in decreasing order easily by sorting the edge-subset D with respect to its indices. The sorting procedure requires O(jDj log jdj) time. Since the current tree has jdj children with bottom edge f; it does not increase the time complexity. 5. Algorithms for Finding All the Spanning Trees. Here, we discuss some algorithms for nding all the spanning trees in undirected graphs. In the previous section, we described an algorithm for nding all the children of a spanning tree. By using Algorithm A as a subprocedure, we can construct a spanning tree enumeration algorithm which traverses the tree structure (T ; ) by using a tree search rule, e.g., depth-rst search rule or breadth-rst search rule. As described in the previous section, we can assign the integer numbers f1; 2; : : : ; mg to E so that Assumption 4.3 holds by applying Nagamochi and Ibaraki's algorithm [21] in O(n + m) time. Thus, the overall time complexity of the enumeration algorithm becomes O(n + m + n): Now we discuss the memory complexity. Each subprocedure (which executes Algorithm A) requires a memory space to maintain the doublet (T 0 ; H(T 0 )) and label set (vertex labels) for each child T 0 of the current spanning tree. It seems that the breadth-rst search rule requires enormous memory space up to O(n + m): However, if a parallel computer is available, it seems that the breadth-rst search rule provides an ecient speedup over the sequential algorithm. If we use the depth-rst search rule, the algorithm maintains at most O(n 2 m) doublets and label sets, since the height of the tree structure (T ; ) is O(n) and any spanning tree node has at most (n 01)(m 0 n + 1) children. Thus the depth-rst search rule requires O(n 3 m) memory space. Now consider the case that we employ both the depth-rst search rule and the recursive structure. When an additional child spanning tree T 0 is obtained, we pause the current subprocedure and start a new subprocedure for nding all the children of the obtained child spanning tree T 0 : Then, each subprocedure maintains only one doublet and a set of vertex labels and so the over all memory complexity becomes O(n 2 ): In the rest of this section, we describe an O(n + m) space algorithm. When we employ the depth-rst search rule, the algorithm maintain a sequence of spanning trees (T 0 = T 3 ; T 1 ; T 2 ; : : : ; T l ) satisfying that T j is a child of T j01 and the length l is less than n: To save the memory space for the doublets f(t j ; H(T j )) j j = 1; 2; : : : ; lg; we maintain the relative dierences ff j g = T j n T j01 ; fg j g = T j01 n T j ; and 1H j = H(T j01 ) n H(T j ) for each j 2 f1; 2; : : : ; lg: Since l < n; we need to maintain at most O(n) edge pairs (f j ; g j ): From Lemma 4.6, T 3 = H(T 0 ) H(T 1 ) H(T l ) and so the overall memory space required for the edge-subsets f1h 1 ; 1H 2 ; : : : ; 1H l g is bounded by O(n): Next, we show an idea to save the memory space for the edge- 8

9 subsets D j = Cycle(T j01 ; f j ) \ H(T j01 ) (j = 1; 2; : : : ; l): If we construct the children f(t j01 n fgg) [ ff j g j g 2 D j g in the order that the edge index of g is decreasing, we do not need to maintain the edge-subset D j : When we update the edge g; we construct the edge-subset D j again in O(n) time and replace the edge g by the bottom edge of fe 0 2 D j j index(e 0 ) < index(g)g: Lastly, we consider the vertex labels obtained by solving the problem label((v; T); H). To save the memory space, we have to erase the vertex labels at the time instance when an additional child spanning tree is obtained. After generating all the descendants of the current child spanning tree, we solve the problem label((v; T ); H) again. Then, overall computational steps required for solving the problem label((v; T ); H) is bounded by O( n): The above modications save the memory complexity to O(n + m) without increasing the time complexity. However, it seems that these modications make the algorithm slower in practice. In the following, we describe the above algorithm in a pseudo code. Algorithm B B1: begin B2: procedure find-children(t; H) B3: (comment: T is the current spanning tree and H = H(T ) ) B4: begin B5: output T ; B6: setk := index(btm(t )); setj 0 := k; setj := k + 1; B7: while j minfj 0 + 2n 0 3; mg do B8: begin B9: solve the problem label((v; T ); H); B10: while j minfj 0 + 2n 0 3; mg and labels of two ends of e j are same do B11: begin set j := j + 1 end B12: erase the vertex labels obtained at Line B9; B13: if j minfj 0 + 2n 0 3; mgthen B14: begin B15: set f := e j ; set j 0 := j; set j := j + 1; set g := e n ; set 1H := ;; B16: repeat B17: begin B18: set g := btm(fe 0 2 Cycle(T; f) \ H j index(e 0 ) < index(g)g); B19: set T := T n fgg [ ffg; set H := H n fgg; set 1H := 1H [ fgg; B20: find-children(t; H); B21: set T := T n ffg [ fgg; B22: end; B23: until g is the top edge of Cycle(T; f) \ H; B24: set H := H [ 1H B25: end; B26: end; B27: end; (comment: end of procedure find-children) B28: begin (comment: start of the main routine) B29: set T = T 3 ; set H = T 3 ; 9

10 B30: find-children(t; H); B31: end; (comment: end of the main routine) B32: end Clearly, the above algorithm requires O(n + m + n) time and O(n + m) space. 6. Generating Spanning Trees in Nondecreasing Order of Weight. In this section, we consider the case that the given graph is weighted. Let w(e) be the weight of the edge e 2 E: For any spanning tree T; its weight P e2t w(e) is denoted by w(t ): A minimum spanning tree problem nds a spanning tree whose weight is minimized. Here, we propose an algorithm for generating all the spanning trees in nondecreasing order of weight by modifying our algorithm. In this section, we assume that the following property holds. Assumption 6.1. The edge-subset T 3 = fe 1 ; e 2 ; : : : ; e n01 g is a minimum weight spanning tree of G and w(e 1 ) w(e 2 ) w(e n01 ): Now we show a lemma which gives an idea to modify our enumeration algorithm to a ranking algorithm for the minimum spanning tree problem. Lemma 6.2. If the edge-set fe 1 ; e 2 ; : : : ; e n01 g satises Assumption 6.1, then for any spanning tree T 0 (6= T 3 ); w(t 0 ) w((t 0 )): Proof. Denote the spanning tree (T 0 ) by (T 0 n ffg) [ fgg: Assumption 6.1 implies that: w(f) minfw(e) j e 2 Cut(T 0 ; f)g = minfw(e) j e 2 Cut(T 0 ; f) \ T 3 g = w(top(cut(t 0 ; f) \ T 3 )) = w(top(cut(t 0 ; f))) = w(g): So, it is clear that w(t 0 ) = w((t 0 )) + w(f) 0 w(g) w((t 0 )): The above lemma says that under Assumption 6.1, the weight of a spanning tree is greater than or equal to that of its parent. We outline our ranking algorithm. The algorithm maintains a set Q of unscanned spanning trees. At the beginning of the algorithm, we set Q = ft 3 g: In each iteration, we nd a spanning tree T 2 Q which attains the value minfw(t 0 ) j T 0 2 Qg and output T: Next, we remove T from Q and add all the children of T to Q: The algorithm repeat the above process until the set Q is empty. From the above lemma, it is clear that this algorithm outputs all the spanning trees in nondecreasing order of weight. When the given graph is dense, the size of Q becomes large. Consider the case that the edge weights satisfy w(e 1 ) + w(e 2 ) w(e m01 ) < w(e m ): When the algorithm output a spanning tree, denoted by T 00 ; including the edge e m for the rst time, the set Q contains all the spanning trees containing the edge e m : If the given graph is complete, the size of Q is equal to 2n n03 (see [5] Exercise 2.4.4). So, even if we maintain the set Q by a usual heap structure, it requires O(n log n) time to delete the tree T 00 from Q: To nd a spanning tree in Q whose weight is minimized eciently, we employ a technique proposed by Kapoor and Ramesh in [14]. Now we describe our ranking algorithm. Algorithm C C1: begin 10

11 C2: set Q ij be the empty queue for (i; j) 2 f1; : : : ; n 0 1g 2 fn; : : : ; mg ; C3: add T 3 to the queue Q 1;n ; C4: while there exists at least one nonempty queue do C5: begin C6: set T be a spanning tree in the set of heads of queues whose weight is minimized; C7: remove T from its queue; output T ; C8: generate all the children of T; C9: for every child T 0 of T do C10: add T 0 to the queue Q ij where T 0 = T n fe i g [ fe j g; C11: end; C12: end At Line C8, we use Algorithm A. It is clear that the spanning trees in every queue are arranged in nondecreasing order of weight throughout the iterations. Thus, the above algorithm generates all the spanning trees in nondecreasing order of weight. We maintain the set of heads of queues by a usual heap structure. Since the number of queues is (n 0 1)(m 0 n + 1), both the insertion to the heap and the deletion from the heap require O(log((n 0 1)(m 0 n + 1))) = O(log n) time. The overall computational eorts required at Lines C7 and C10 is O( log n): If we have a minimum spanning tree, we can assign the edge indices satisfying Assumption 6.1 in O(n log n) time. At Line C2, Algorithm C create (n 0 1)(m 0 n + 1) empty queues and it requires O(n(m 0 n)) time. From the above, Algorithm C requires O(n(m 0 n) + m + n log n + n) time and O(m + n) space when we have a minimum spanning tree. In the following, we reduce the time complexity of Algorithm C. In Algorithm C, we need not maintain empty queues. So, it is enough to create a new empty queue at the rst time instance when it is required. If we employ the above idea, searching the desired queue at Line C10 becomes dicult. To overcome this diculty, we use an ordinary balanced binary tree such as AVL-tree [1]. We assign the number i + (j 0 n)n to the queue Q ij and maintain pointers to the constructed queues by a balanced tree with respect to the assigned numbers. Then we can nd the desired queue at Line C10 and/or decide to create a new empty queue in O(log((n 0 1)(m 0 n + 1)) = O(log n) time. Then the overall time complexity for searching the desired queue and inserting the constructed queues to the balanced tree is bounded by O( log n): Now we have a ranking algorithm which requires O(m + n log n + n) time when we have a minimum spanning tree. By employing an O(m + n log n) time algorithm for minimum spanning tree problem [10], the over all time complexity becomes O(m + n log n + n): Lastly, we reduce the time complexity of Algorithm C to O(m + n + n) when we have a minimum spanning tree. Here we have to consider the computational eort to assign the edge indices satisfying Assumption 6.1. If we sort the minimum spanning tree edges, it requires O(n log n) time. However, we need not sort the minimum spanning tree edges. In Algorithm A, we need the order of indices of the minimum spanning tree edges only at the line for updating the edge set H(T ): When Algorithm A nds a child spanning tree T 0 of the current spanning tree T = (T 0 ); we construct the edge 11

12 set H(T 0 ) by the formula H(T 0 ) = H(T ) n fe 0 2 Cycle(T; f) \ H(T ) j index(e 0 ) index(g)g where fgg = T n T 0 : If we have the nondegeneracy assumption such that w(e) 6= w(e 0 ) when e 6= e 0 ; the above formula is equivalent to the following H(T 0 ) = H(T ) n fe 0 2 Cycle(T; f) \ H(T ) j w(e 0 ) w(g)g: We can assume the nondegeneracy property by breaking ties lexicographically. The above formula implies that we can construct the edge set H(T 0 ) in O(n) time, even if the minimum tree edges are not sorted. From the above, Algorithm C requires O(n + m + n) time and O(m + n) space when we have a minimum spanning tree. In Algorithm C, we used (modied) Kapoor and Ramesh's data structure. When the weight vector is integer valued we can apply the radix heap structure developed for the shortest path algorithm [2] (see [3] Section 4.8 also). If we employ the radix heap structure, the time complexity of Algorithm C becomes O(n + m + (n + log W )) and space complexity becomes O(m + n + log W ) where W = maxfjw(e)j j e 2 Eg: From practical point of view, the radix heap structure is very simple and seems ecient. 7. Conclusion. In this paper, we proposed some O(n + m + n) time algorithms which traverses a tree structure on the spanning tree polytope and generates all the spanning trees. If we use the depth-rst rule, the memory requirement becomes O(n + m): The breadth-rst search rule requires as much as O(m + n) space, but when a parallel computer is available, the breadth-rst search rule provides an ecient speedup over the sequential algorithm. By employing best-rst search rule we obtain a ranking algorithm for minimum spanning tree problem. If we use (modied) Kapoor and Ramesh's data structure, the algorithm requires O(n + m + n) time and O(m + n) space when we have a minimum spanning tree. When the weight vector is integer valued, the radix heap implementation provides a ranking algorithm which requires O(n + m + (n + log W)) time and O(m + n + log W ) space. Since our algorithm is exible, one can construct an enumeration type algorithm for the minimum spanning tree problem with additional constraints by choosing an appropriate tree traversing strategy. REFERENCES [1] G.M. Adel'son-Vel'skii and E.M. Landis, An information organization algorithm, Doklady Akad. Nauk SSSR 146 (1962), pp.263{266, Trans. Sovjet Math. Dokl. 3 (1962), pp.1259{1262. [2] R.K. Ahuja, K. Mehlhorn, J.B. Orlin and R.E. Tarjan, Faster algorithms for the shortest path problem, J. of ACM 37 (1990), pp.213{223. [3], R.K. Ahuja, T.L. Magnanti and J.B. Orlin, Network Flows: Theory, Algorithm and Applications, Prentice Hall, [4] D. Avis and K. Fukuda, Reverse search for enumeration, research report 92-5, Graduate School of Systems Management, The University of Tsukuba, [5] J. Bondy and U. S. R. Murty, Graph Theory with Applications, The Macmilliam Press,

13 [6] R. Burns and C. Haff, A combinatorial ranking problem, Aequationes Mathematics, 14 (1976), pp. 351{355. [7] T. Cormen, C. Leiserson, and R. Rivest, Introduction to Algorithms, The MIT-Press, Cambridge, Massachusetts, [8] D. Eppstein, Z. Galil, G.F. Italiano and A. Nissenzweig Sparsication { a technique for speeding up dynamic graph algorithms, In 33th Annual Symposium on Foundations of Computer Science, Pittsburgh, Pennsylvania (1992), pp.60{69. [9] G.N. Frederickson, Ambivalent data structures for dynamic 2-edge-connectivity and k smallest spanning trees, In 32th Annual Symposium on Foundations of Computer Science, San Juan, Puerto Rico (1991), pp.632{641. [10] M. L. Fredman and R. E. Tarjan, Fibonacci heaps and their uses in improved network optimization problems, J. of ACM, 34 (1987), pp. 596{615. [11] H. Gabow, Two algorithms for generating weighted spanning trees in order, SIAM J. Computing, 6 (1977), pp. 139{150. [12] H. Gabow, Z. Galil, T. Spencer, and R. Tarjan, Ecient algorithms for nding minimum spanning trees in undirected trees in undirected and directed graphs, Combinatorica, 6 (1986), pp. 109{122. [13] H. Gabow and E. Myers, Finding all spanning trees of directed and undirected graphs, SIAM J. Computing, 7 (1978), pp. 280{287. [14] S. Kapoor and H. Ramesh, Algorithms for enumerating all spanning trees of undirected and weighted graphs, SIAM J. Computing 24 (1995), pp.247{265. [15] N. Katoh, T. Ibaraki, and H. Mine, An algorithm for nding K minimum spanning trees, SIAM J. Computing, 10 (1981), pp. 247{255. [16] J. B. Kruskal, On the shortest spanning subtree of a graph and the traveling salesman problem, Proc. American Math. Society, 2 (1956), pp. 48{50. [17] H. Loberman and A. Weinberger, Formal procedures for connecting terminals with a minimum total wire length, J. of ACM, 4 (1957), pp. 428{437. [18] W. Mayeda and S. Seshu, Generation of trees without duplications, IEEE Trans. on Circuit Theory, CT-12 (1965), pp. 181{185. [19] G. J. Minty, A simple algorithm for listing all the trees of a graph, IEEE Trans. on Circuit Theory, CT-12 (1965), p [20] K. Murty, R. Saigal, and J. Suurballe, Ranking algorithm for spanning trees, tech. report, Bell labs. memo, Network Programming; K.G. Murty, 1992, Prentice-Hall. [21] H. Nagamochi and T. Ibaraki, Linear time algorithm for nding a sparse k-connected spanning subgraph of a k-connected graph, Algorithmica, 7 (1992), pp. 583{596. [22] R. C. Prim, Shortest connection networks and some generalizations, Bell System Tech. J., 36 (1957), pp. 1389{1401. [23] R. C. Read and R. E. Tarjan, Bounds on backtrack algorithms for listing cycles, paths, and spanning trees, Networks, 5 (1975), pp. 237{252. [24] A. Shioura and A. Tamura, Eciently scanning all spanning trees of an undirected graph, J. of Operation Research Society of Japan, 38 (1995), pp.331{344. [25] A. Shioura, A. Tamura and T. Uno, An optimal algorithm for scanning all spanning trees of undirected graphs, to appear in SIAM J. on Computing. [26] R. Tarjan, Depth-rst search and linear graph algorithms, SIAM J. Comput., 1 (1972), pp. 146{ 160. [27] H. Watanabe, A computational method for network topology, IRE Trans., CT-7 (1960), pp. 296{ 302. [28] A. Yao, An O(jEj log log jv j) algorithm for nding minimum spanning trees, Information Processing Letters, 4 (1975), pp. 21{23. 13

A Linear Time Algorithm for the Minimum Spanning Tree Problem. on a Planar Graph. Tomomi MATSUI. (January 1994 )

A Linear Time Algorithm for the Minimum Spanning Tree Problem. on a Planar Graph. Tomomi MATSUI. (January 1994 ) A Linear Time Algorithm for the Minimum Spanning Tree Problem on a Planar Graph Tomomi MATSUI (January 994 ) Department of Mathematical Engineering and Information Physics Faculty of Engineering, University

More information

The Minimum Spanning Tree Problem on a Planar Graph. Tomomi MATSUI. (February 1994 ) Department of Mathematical Engineering and Information Physics

The Minimum Spanning Tree Problem on a Planar Graph. Tomomi MATSUI. (February 1994 ) Department of Mathematical Engineering and Information Physics The Minimum Spanning Tree Problem on a Planar Graph Tomomi MATSUI (February 994 ) Department of Mathematical Engineering and Information Physics Faculty of Engineering, University of Tokyo Bunkyo-ku, Tokyo

More information

An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph

An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph (C) Springer Verlag, Lecture Notes on Computer Sience An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph Takeaki UNO Department of Systems Science, Tokyo Institute of Technology,

More information

Minimum Spanning Trees My T. UF

Minimum Spanning Trees My T. UF Introduction to Algorithms Minimum Spanning Trees @ UF Problem Find a low cost network connecting a set of locations Any pair of locations are connected There is no cycle Some applications: Communication

More information

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the Heap-on-Top Priority Queues Boris V. Cherkassky Central Economics and Mathematics Institute Krasikova St. 32 117418, Moscow, Russia cher@cemi.msk.su Andrew V. Goldberg NEC Research Institute 4 Independence

More information

[13] D. Karger, \Using randomized sparsication to approximate minimum cuts" Proc. 5th Annual

[13] D. Karger, \Using randomized sparsication to approximate minimum cuts Proc. 5th Annual [12] F. Harary, \Graph Theory", Addison-Wesley, Reading, MA, 1969. [13] D. Karger, \Using randomized sparsication to approximate minimum cuts" Proc. 5th Annual ACM-SIAM Symposium on Discrete Algorithms,

More information

Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C

Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of California, San Diego CA 92093{0114, USA Abstract. We

More information

The Number of Connected Components in Graphs and Its. Applications. Ryuhei Uehara. Natural Science Faculty, Komazawa University.

The Number of Connected Components in Graphs and Its. Applications. Ryuhei Uehara. Natural Science Faculty, Komazawa University. The Number of Connected Components in Graphs and Its Applications Ryuhei Uehara uehara@komazawa-u.ac.jp Natural Science Faculty, Komazawa University Abstract For any given graph and an integer k, the number

More information

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast

More information

Clustering for Faster Network Simplex Pivots

Clustering for Faster Network Simplex Pivots Clustering for Faster Network Simplex Pivots David Eppstein Department of Information and Computer Science University of California, Irvine, CA 92717 Tech. Report 93-19 April 15, 1993 Abstract We show

More information

Localization in Graphs. Richardson, TX Azriel Rosenfeld. Center for Automation Research. College Park, MD

Localization in Graphs. Richardson, TX Azriel Rosenfeld. Center for Automation Research. College Park, MD CAR-TR-728 CS-TR-3326 UMIACS-TR-94-92 Samir Khuller Department of Computer Science Institute for Advanced Computer Studies University of Maryland College Park, MD 20742-3255 Localization in Graphs Azriel

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, ) Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 1. if >. 2. error new key is greater than current key 3.. 4.. 5. if NIL and.

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees. Tree 1. Trees and their Properties. Spanning trees 3. Minimum Spanning Trees 4. Applications of Minimum Spanning Trees 5. Minimum Spanning Tree Algorithms 1.1 Properties of Trees: Definition: A graph G

More information

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207. MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public.it-sudparis.eu/~gibson/teaching/mat7003/ Graphs and Trees http://www-public.it-sudparis.eu/~gibson/teaching/mat7003/l2-graphsandtrees.pdf

More information

PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet

PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet IEICE TRANS. FUNDAMENTALS, VOL.E8??, NO. JANUARY 999 PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet Tetsuo SHIBUYA, SUMMARY The problem of constructing the suffix tree of a tree is

More information

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast algorithms to solve

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18 CS 124 Quiz 2 Review 3/25/18 1 Format You will have 83 minutes to complete the exam. The exam may have true/false questions, multiple choice, example/counterexample problems, run-this-algorithm problems,

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo

More information

Algorithm Design (8) Graph Algorithms 1/2

Algorithm Design (8) Graph Algorithms 1/2 Graph Algorithm Design (8) Graph Algorithms / Graph:, : A finite set of vertices (or nodes) : A finite set of edges (or arcs or branches) each of which connect two vertices Takashi Chikayama School of

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures Chapter 9 Graph s 2 Definitions Definitions an undirected graph is a finite set

More information

arxiv: v1 [cs.ds] 23 Jul 2014

arxiv: v1 [cs.ds] 23 Jul 2014 Efficient Enumeration of Induced Subtrees in a K-Degenerate Graph Kunihiro Wasa 1, Hiroki Arimura 1, and Takeaki Uno 2 arxiv:1407.6140v1 [cs.ds] 23 Jul 2014 1 Hokkaido University, Graduate School of Information

More information

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1 Asymptotics, Recurrence and Basic Algorithms 1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1 1. O(logn) 2. O(n) 3. O(nlogn) 4. O(n 2 ) 5. O(2 n ) 2. [1 pt] What is the solution

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

Foundations of Discrete Mathematics

Foundations of Discrete Mathematics Foundations of Discrete Mathematics Chapter 12 By Dr. Dalia M. Gil, Ph.D. Trees Tree are useful in computer science, where they are employed in a wide range of algorithms. They are used to construct efficient

More information

Tree-Weighted Neighbors and Geometric k Smallest Spanning Trees

Tree-Weighted Neighbors and Geometric k Smallest Spanning Trees Tree-Weighted Neighbors and Geometric k Smallest Spanning Trees David Eppstein Department of Information and Computer Science University of California, Irvine, CA 92717 Tech. Report 92-77 July 7, 1992

More information

Representing all Minimum Spanning Trees with Applications to Counting and Generation

Representing all Minimum Spanning Trees with Applications to Counting and Generation Representing all Minimum Spanning Trees with Applications to Counting and Generation David Eppstein Department of Information and Computer Science University of California, Irvine, CA 92717 http://www.ics.uci.edu/

More information

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem Minimum Spanning Trees (Forests) Given an undirected graph G=(V,E) with each edge e having a weight w(e) : Find a subgraph T of G of minimum total weight s.t. every pair of vertices connected in G are

More information

So the actual cost is 2 Handout 3: Problem Set 1 Solutions the mark counter reaches c, a cascading cut is performed and the mark counter is reset to 0

So the actual cost is 2 Handout 3: Problem Set 1 Solutions the mark counter reaches c, a cascading cut is performed and the mark counter is reset to 0 Massachusetts Institute of Technology Handout 3 6854/18415: Advanced Algorithms September 14, 1999 David Karger Problem Set 1 Solutions Problem 1 Suppose that we have a chain of n 1 nodes in a Fibonacci

More information

1 Minimum Spanning Trees: History

1 Minimum Spanning Trees: History -80: Advanced Algorithms CMU, Spring 07 Lecture #: Deterministic MSTs January, 07 Lecturer: Anupam Gupta Scribe: Anshu Bansal, C.J. Argue Minimum Spanning Trees: History The minimum spanning tree problem

More information

CSE 100: GRAPH ALGORITHMS

CSE 100: GRAPH ALGORITHMS CSE 100: GRAPH ALGORITHMS Dijkstra s Algorithm: Questions Initialize the graph: Give all vertices a dist of INFINITY, set all done flags to false Start at s; give s dist = 0 and set prev field to -1 Enqueue

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Overview Problem A town has a set of houses and a set of roads. A road connects and only houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and

More information

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition. 18.433 Combinatorial Optimization Matching Algorithms September 9,14,16 Lecturer: Santosh Vempala Given a graph G = (V, E), a matching M is a set of edges with the property that no two of the edges have

More information

COMP 355 Advanced Algorithms

COMP 355 Advanced Algorithms COMP 355 Advanced Algorithms Algorithms for MSTs Sections 4.5 (KT) 1 Minimum Spanning Tree Minimum spanning tree. Given a connected graph G = (V, E) with realvalued edge weights c e, an MST is a subset

More information

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck Theory of Computing Lecture 10 MAS 714 Hartmut Klauck Seven Bridges of Königsberg Can one take a walk that crosses each bridge exactly once? Seven Bridges of Königsberg Model as a graph Is there a path

More information

Algorithms for Minimum Spanning Trees

Algorithms for Minimum Spanning Trees Algorithms & Models of Computation CS/ECE, Fall Algorithms for Minimum Spanning Trees Lecture Thursday, November, Part I Algorithms for Minimum Spanning Tree Sariel Har-Peled (UIUC) CS Fall / 6 Sariel

More information

PARTITIONING THE LABELED SPANNING TREES OF AN ARBITRARY GRAPH INTO ISOMORPHISM CLASSES. Austin Mohr

PARTITIONING THE LABELED SPANNING TREES OF AN ARBITRARY GRAPH INTO ISOMORPHISM CLASSES. Austin Mohr PARTITIONING THE LABELED SPANNING TREES OF AN ARBITRARY GRAPH INTO ISOMORPHISM CLASSES by Austin Mohr Bachelor of Science in Mathematics, Southern Illinois University, 2007 A Research Paper Submitted in

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs Representations of Weighted Graphs (as Matrices) A B Algorithms and Data Structures: Minimum Spanning Trees 9.0 F 1.0 6.0 5.0 6.0 G 5.0 I H 3.0 1.0 C 5.0 E 1.0 D 28th Oct, 1st & 4th Nov, 2011 ADS: lects

More information

would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp

would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp 1 Introduction 1.1 Parallel Randomized Algorihtms Using Sampling A fundamental strategy used in designing ecient algorithms is divide-and-conquer, where that input data is partitioned into several subproblems

More information

Part 2: Balanced Trees

Part 2: Balanced Trees Part 2: Balanced Trees 1 AVL Trees We could dene a perfectly balanced binary search tree with N nodes to be a complete binary search tree, one in which every level except the last is completely full. A

More information

Design and Analysis of Algorithms - - Assessment

Design and Analysis of Algorithms - - Assessment X Courses» Design and Analysis of Algorithms Week 1 Quiz 1) In the code fragment below, start and end are integer values and prime(x) is a function that returns true if x is a prime number and false otherwise.

More information

The problem of minimizing the elimination tree height for general graphs is N P-hard. However, there exist classes of graphs for which the problem can

The problem of minimizing the elimination tree height for general graphs is N P-hard. However, there exist classes of graphs for which the problem can A Simple Cubic Algorithm for Computing Minimum Height Elimination Trees for Interval Graphs Bengt Aspvall, Pinar Heggernes, Jan Arne Telle Department of Informatics, University of Bergen N{5020 Bergen,

More information

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem Ahmad Biniaz Anil Maheshwari Michiel Smid September 30, 2013 Abstract Let P and S be two disjoint sets of n and m points in the

More information

CS170 First Midterm Answers 17 Feb { What are the strongly connected components of the directed graph shown below?

CS170 First Midterm Answers 17 Feb { What are the strongly connected components of the directed graph shown below? S70 First Midterm Answers 7 Feb 998 Answer to Version of Question. (3 points) { What are the strongly connected components of the directed graph shown below? A 000000 0000 00000 0 E H 0 0 00 0000 0 00

More information

Steiner Problems on Directed Acyclic Graphs. November 3, Abstract. In this paper, we consider two variations of the minimum-cost Steiner problem

Steiner Problems on Directed Acyclic Graphs. November 3, Abstract. In this paper, we consider two variations of the minimum-cost Steiner problem Steiner Problems on Directed Acyclic Graphs Tsan-sheng Hsu y, Kuo-Hui Tsai yz, Da-Wei Wang yz and D. T. Lee? November 3, 1995 Abstract In this paper, we consider two variations of the minimum-cost Steiner

More information

Distributed minimum spanning tree problem

Distributed minimum spanning tree problem Distributed minimum spanning tree problem Juho-Kustaa Kangas 24th November 2012 Abstract Given a connected weighted undirected graph, the minimum spanning tree problem asks for a spanning subtree with

More information

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm Spanning Trees 1 Spanning Trees the minimum spanning tree problem three greedy algorithms analysis of the algorithms 2 The Union-Find Data Structure managing an evolving set of connected components implementing

More information

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Introduction to Algorithms Third Edition

Introduction to Algorithms Third Edition Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Introduction to Algorithms Third Edition The MIT Press Cambridge, Massachusetts London, England Preface xiü I Foundations Introduction

More information

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 Q1: Prove or disprove: You are given a connected undirected graph G = (V, E) with a weight function w defined over its

More information

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs Graphs and Network Flows ISE 411 Lecture 7 Dr. Ted Ralphs ISE 411 Lecture 7 1 References for Today s Lecture Required reading Chapter 20 References AMO Chapter 13 CLRS Chapter 23 ISE 411 Lecture 7 2 Minimum

More information

Lecture 13: AVL Trees and Binary Heaps

Lecture 13: AVL Trees and Binary Heaps Data Structures Brett Bernstein Lecture 13: AVL Trees and Binary Heaps Review Exercises 1. ( ) Interview question: Given an array show how to shue it randomly so that any possible reordering is equally

More information

Parallel Graph Algorithms

Parallel Graph Algorithms Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050 Spring 202 Part I Introduction Overview Graphsdenitions, properties, representation Minimal spanning tree Prim's algorithm Shortest

More information

CSci 231 Final Review

CSci 231 Final Review CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.

More information

CS 6783 (Applied Algorithms) Lecture 5

CS 6783 (Applied Algorithms) Lecture 5 CS 6783 (Applied Algorithms) Lecture 5 Antonina Kolokolova January 19, 2012 1 Minimum Spanning Trees An undirected graph G is a pair (V, E); V is a set (of vertices or nodes); E is a set of (undirected)

More information

21# 33# 90# 91# 34# # 39# # # 31# 98# 0# 1# 2# 3# 4# 5# 6# 7# 8# 9# 10# #

21# 33# 90# 91# 34# # 39# # # 31# 98# 0# 1# 2# 3# 4# 5# 6# 7# 8# 9# 10# # 1. Prove that n log n n is Ω(n). York University EECS 11Z Winter 1 Problem Set 3 Instructor: James Elder Solutions log n n. Thus n log n n n n n log n n Ω(n).. Show that n is Ω (n log n). We seek a c >,

More information

Enumeration of Full Graphs: Onset of the Asymptotic Region. Department of Mathematics. Massachusetts Institute of Technology. Cambridge, MA 02139

Enumeration of Full Graphs: Onset of the Asymptotic Region. Department of Mathematics. Massachusetts Institute of Technology. Cambridge, MA 02139 Enumeration of Full Graphs: Onset of the Asymptotic Region L. J. Cowen D. J. Kleitman y F. Lasaga D. E. Sussman Department of Mathematics Massachusetts Institute of Technology Cambridge, MA 02139 Abstract

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

[25] T. Watanabe, An ecient way for edge-connectivity augmentation, Tech. Rep. ACT-

[25] T. Watanabe, An ecient way for edge-connectivity augmentation, Tech. Rep. ACT- [25] T. Watanabe, An ecient way for edge-connectivity augmentation, Tech. Rep. ACT- 76-UILU-ENG-87-2221, Coordinated Science lab., University of Illinois, Urbana, IL, 1987. [26] T. Watanabe and A. Nakamura,

More information

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path. Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

More information

Randomized Graph Algorithms

Randomized Graph Algorithms Randomized Graph Algorithms Vasileios-Orestis Papadigenopoulos School of Electrical and Computer Engineering - NTUA papadigenopoulos orestis@yahoocom July 22, 2014 Vasileios-Orestis Papadigenopoulos (NTUA)

More information

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29 Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms

More information

3 Competitive Dynamic BSTs (January 31 and February 2)

3 Competitive Dynamic BSTs (January 31 and February 2) 3 Competitive Dynamic BSTs (January 31 and February ) In their original paper on splay trees [3], Danny Sleator and Bob Tarjan conjectured that the cost of sequence of searches in a splay tree is within

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Reference Sheet for CO142.2 Discrete Mathematics II

Reference Sheet for CO142.2 Discrete Mathematics II Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no

More information

CSE 373 MAY 10 TH SPANNING TREES AND UNION FIND

CSE 373 MAY 10 TH SPANNING TREES AND UNION FIND CSE 373 MAY 0 TH SPANNING TREES AND UNION FIND COURSE LOGISTICS HW4 due tonight, if you want feedback by the weekend COURSE LOGISTICS HW4 due tonight, if you want feedback by the weekend HW5 out tomorrow

More information

Abstract Updating a minimum spanning tree (MST) is a basic problem for communication networks. In this paper, we consider single node deletions in MST

Abstract Updating a minimum spanning tree (MST) is a basic problem for communication networks. In this paper, we consider single node deletions in MST Reconstructing a Minimum Spanning Tree after Deletion of Any Node Bevan Das and Michael C. Loui y March 1, 1999 Lucent Technologies, PO Box 7033, Naperville, IL 60566-7033. This work was done as part of

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 9 Minimum Spanning Trees Thanks to the text authors who contributed to these slides Why Minimum Spanning Trees (MST)? Example 1 A

More information

) $ f ( n) " %( g( n)

) $ f ( n)  %( g( n) CSE 0 Name Test Spring 008 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to compute the sum of the n elements of an integer array is: # A.

More information

6. Lecture notes on matroid intersection

6. Lecture notes on matroid intersection Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans May 2, 2017 6. Lecture notes on matroid intersection One nice feature about matroids is that a simple greedy algorithm

More information

Abstract Relaxed balancing of search trees was introduced with the aim of speeding up the updates and allowing a high degree of concurrency. In a rela

Abstract Relaxed balancing of search trees was introduced with the aim of speeding up the updates and allowing a high degree of concurrency. In a rela Chromatic Search Trees Revisited Institut fur Informatik Report 9 Sabine Hanke Institut fur Informatik, Universitat Freiburg Am Flughafen 7, 79 Freiburg, Germany Email: hanke@informatik.uni-freiburg.de.

More information

Buckets, Heaps, Lists, and. Monotone Priority Queues. Craig Silverstein y. Computer Science Department. Stanford University. Stanford, CA 94305

Buckets, Heaps, Lists, and. Monotone Priority Queues. Craig Silverstein y. Computer Science Department. Stanford University. Stanford, CA 94305 Buckets, Heaps, Lists, and Monotone Priority Queues Boris V. Cherkassky Central Econ. and Math. Inst. Krasikova St. 32 117418, Moscow, Russia cher@cemi.msk.su Andrew V. Goldberg NEC Research Institute

More information

What is a minimal spanning tree (MST) and how to find one

What is a minimal spanning tree (MST) and how to find one What is a minimal spanning tree (MST) and how to find one A tree contains a root, the top node. Each node has: One parent Any number of children A spanning tree of a graph is a subgraph that contains all

More information

On the other hand, the main disadvantage of the amortized approach is that it cannot be applied in real-time programs, where the worst-case bound on t

On the other hand, the main disadvantage of the amortized approach is that it cannot be applied in real-time programs, where the worst-case bound on t Randomized Meldable Priority Queues Anna Gambin and Adam Malinowski Instytut Informatyki, Uniwersytet Warszawski, Banacha 2, Warszawa 02-097, Poland, faniag,amalg@mimuw.edu.pl Abstract. We present a practical

More information

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F))

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F)) DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING EC6301 OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES UNIT IV NONLINEAR DATA STRUCTURES Part A 1. Define Tree [N/D 08]

More information

Course Review for Finals. Cpt S 223 Fall 2008

Course Review for Finals. Cpt S 223 Fall 2008 Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,

More information

Math 443/543 Graph Theory Notes

Math 443/543 Graph Theory Notes Math 443/543 Graph Theory Notes David Glickenstein September 3, 2008 1 Introduction We will begin by considering several problems which may be solved using graphs, directed graphs (digraphs), and networks.

More information

Introduction to Optimization

Introduction to Optimization Introduction to Optimization Greedy Algorithms October 28, 2016 École Centrale Paris, Châtenay-Malabry, France Dimo Brockhoff Inria Saclay Ile-de-France 2 Course Overview Date Fri, 7.10.2016 Fri, 28.10.2016

More information

Algorithms. AVL Tree

Algorithms. AVL Tree Algorithms AVL Tree Balanced binary tree The disadvantage of a binary search tree is that its height can be as large as N-1 This means that the time needed to perform insertion and deletion and many other

More information

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees CSE1 Introduction to Algorithms Lecture 1 Minimum Spanning Trees Antoine Vigneron antoine@unist.ac.kr Ulsan National Institute of Science and Technology July 11, 201 Antoine Vigneron (UNIST) CSE1 Lecture

More information

Graph Algorithms Using Depth First Search

Graph Algorithms Using Depth First Search Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth

More information

2pt 0em. Computer Science & Engineering 423/823 Design and Analysis of Algorithms. Lecture 04 Minimum-Weight Spanning Trees (Chapter 23)

2pt 0em. Computer Science & Engineering 423/823 Design and Analysis of Algorithms. Lecture 04 Minimum-Weight Spanning Trees (Chapter 23) 2pt 0em Computer Science & Engineering 423/823 Design and of s Lecture 04 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 18 Given a connected, undirected

More information

DATA STRUCTURES AND ALGORITHMS

DATA STRUCTURES AND ALGORITHMS DATA STRUCTURES AND ALGORITHMS UNIT 1 - LINEAR DATASTRUCTURES 1. Write down the definition of data structures? A data structure is a mathematical or logical way of organizing data in the memory that consider

More information

Lecture notes on: Maximum matching in bipartite and non-bipartite graphs (Draft)

Lecture notes on: Maximum matching in bipartite and non-bipartite graphs (Draft) Lecture notes on: Maximum matching in bipartite and non-bipartite graphs (Draft) Lecturer: Uri Zwick June 5, 2013 1 The maximum matching problem Let G = (V, E) be an undirected graph. A set M E is a matching

More information

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

End-Term Examination Second Semester [MCA] MAY-JUNE 2006 (Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.

More information

Lecture 5 Using Data Structures to Improve Dijkstra s Algorithm. (AM&O Sections and Appendix A)

Lecture 5 Using Data Structures to Improve Dijkstra s Algorithm. (AM&O Sections and Appendix A) Lecture Using Data Structures to Improve Dijkstra s Algorithm (AM&O Sections 4.6 4.8 and Appendix A) Manipulating the Data in Dijkstra s Algorithm The bottleneck operation in Dijkstra s Algorithm is that

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 16 Greedy Algorithms (and Graphs) Graph representation Minimum spanning trees Optimal substructure Greedy choice Prim s greedy MST algorithm Prof. Charles

More information

For example, in the widest-shortest path heuristic [8], a path of maximum bandwidth needs to be constructed from a structure S that contains all short

For example, in the widest-shortest path heuristic [8], a path of maximum bandwidth needs to be constructed from a structure S that contains all short A Note on Practical Construction of Maximum Bandwidth Paths Navneet Malpani and Jianer Chen Λ Department of Computer Science Texas A&M University College Station, TX 77843-3112 Abstract Constructing maximum

More information

Chordal Graphs: Theory and Algorithms

Chordal Graphs: Theory and Algorithms Chordal Graphs: Theory and Algorithms 1 Chordal graphs Chordal graph : Every cycle of four or more vertices has a chord in it, i.e. there is an edge between two non consecutive vertices of the cycle. Also

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 13 Graph algorithms Graph representation Minimum spanning trees Greedy algorithms Optimal substructure Greedy choice Prim s greedy MST algorithm Prof.

More information

Greedy Algorithms. At each step in the algorithm, one of several choices can be made.

Greedy Algorithms. At each step in the algorithm, one of several choices can be made. Greedy Algorithms At each step in the algorithm, one of several choices can be made. Greedy Strategy: make the choice that is the best at the moment. After making a choice, we are left with one subproblem

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May www.jwjobs.net R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 *******-****** 1. a) Which of the given options provides the

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019 CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction

More information

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie Maintaining -balanced Trees by Partial Rebuilding Arne Andersson Department of Computer Science Lund University Box 8 S-22 00 Lund Sweden Abstract The balance criterion dening the class of -balanced trees

More information