III Optimal Trees and Branchings
|
|
- Everett Shields
- 6 years ago
- Views:
Transcription
1 Efficient Graph Algorithms III Optimal Trees and Branchings III Optimal Trees and Branchings Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 1
2 MST Problem Description MST problem arises from the area of network design: connecting nodes with minimal cost / distance /... Given: Connected graph G = (V, E) with positive edge costs c e > 0 for all e E. Sought: Edge set T E, such that (V, T ) is connected and c e is minimal. If (V, T ) is a tree, it is called minimum spanning tree (MST). Observation 1 An optimal solution for the above problem is always a (minimum spanning) tree. What about......calculating all spanning trees and taking the one implying minimum weight? e T Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 2
3 MAX-FOREST Total enumeration does not make any sense, because: Cayley: there are n n 2 spanning trees in K n. Assume we are able to enumerate 10 6 trees per second with n = 30 this would take /10 6 seconds = years. MAX-FOREST: find a forest of maximal weight (with positive edge costs, creation of a forest of minimal weight is not useful at all). Definition 2 Problem classes P and Q are called equivalent if there is a linear transformation between P and Q, i.e. there are linear time functions f, g with: f transforms instances x P into instances y Q, g transforms solutions z of instance f (x) into solutions of x P, z optimal in f (x) g(z) optimal in x. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 3
4 MST MAX-FOREST Lemma 3 MST and MAX-FOREST are equivalent. Proof. Let G be connected and weighted. Let A be an algorithm computing a MAX-FOREST. Set M := max{ c e e E} + 1 and c e := M c e, e E. Use algorithm A to compute a MAX-FOREST F of G with respect to c e. G connected, c e > 0, e E F is a tree. Because of the complementation of c e with respect to M, F is minimal for G with original weights c e. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 4
5 MST MAX-FOREST Proof (cont d). Let now A be an algorithm that computes an MST. The goal is to find a MAX-FOREST. Regard complete graph K n and set M := n (max{ c e e E} + 1 and c e := { ce, for all e E with c e > 0, M, otherwise. A computes an MST T for K n with weights c e. Obviously, T \ {e T c e = M} is a MAX-FOREST in G w.r.t. the original weights c e. Alternatively, we might compute the components of G (negative edges are removed immediately), complement the edge weights and apply algorithm A on the components. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 5
6 A General Greedy Approach We give a general algorithm that labels edges either blue or red. During the procedure, at any time the invariant is satisfied: Among all MSTs, there is one containing all blue edges and no red edge. During the procedure, we use the following labeling rules: blue rule (cut property): Choose a cut that does not contain any blue edge. Choose the shortest unlabeled edge in this cut and label it blue. red rule (cycle property): Choose a cycle that does not contain any red edge. Choose the longest unlabeled edge in this cycle and label it red. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 6
7 MST(G, c) MST(G, c) 1. All edges are unlabeled. 2. Apply rules blue and red until all edges are labeled. 3. The blue edges form an MST. Proposition 4 MST(G, c) computes an MST. Proof. Initially, we show that the above invariant holds. Trivially, it holds at the beginning. Thus, it is to show that application of the blue and red rules does not violate it. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 7
8 Correctness of MST(G, c) (1) Correctness of the blue rule Let e E be labeled blue in Step 2. If e T, nothing is to show. Let e / T and δ(w ) be the associated cut. Then, there is a path connecting the two nodes incident with e, and at least one of its edges is in δ(w ). e e Let e be such an edge. As the invariant holds, no edge in T is labeled red and e is unlabeled. According to the blue rule, it is c e c e. If we replace e by e in T, another MST satisfying the invariant emerges. In particular, c e = c e. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 8
9 Correctness of MST(G, c) (2) Correctness of the red rule e and T as above. If e / T, then the invariant is satisfied. Therefore, assume e T. If we remove e from T, T is not connected anymore. Thus, the cycle used in the red rule, must have contained another edge e with endnodes in both subtrees. e e has not been labeled yet, and according to the red rule, c e c e holds. As above, by replacing e by e, we obtain a new MST satisfying the invariant. e Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 9
10 Correctness of MST(G, c) (3) Correctness of MST(G, c) Remains to show that all edges are labeled during MST(G, c): Let e be unlabeled. According to the invariant, all blue edges form a forest (possibly containing isolated nodes). We regard an edge e = (u, v): (Case 1) u and v are part of the same tree: apply the red rule for eliminating the cycle consisting of e and the path u v in the tree connecting u and v.(case 2) u and v are part of different trees: a cut δ(w ) is induced by the nodes of either the tree containing u, or the tree containing v. One edge (not necessarily e) is labeled blue. Note that, in the above algorithm, the labeling is non-deterministic. In order to obtain an efficient implementation, we have to specify the application of the labeling rules more precisely. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 10
11 Matroids Definition 5 (Matroid) A matroid is a pair (E, U), where U is a subset system of E which satisfies the following properties: 1. U 2. A B, B U = A U 3. A, B U, A < B = x B \ A with A {x} U (exchange property) The elements of E are called elements of the matroid, elements of U are called independent subsets of (E, U). Theorem 6 Let (E, U) be a matroid. Then, the canonical Greedy algorithm is optimal w.r.t. any weighting function w : E R. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 11
12 MST and Matroids Theorem 7 The subset system of MST (all forest of G) is a matroid. Proof. Properties 1 and 2 are clear. To show is the exchange property. Regard two acyclic subsets A, B E, A < B. Let V 1,..., V k V be the connected components of G = (V, A). As A < B n 1, A is not a spanning tree. Therefore, k 2. As B is acyclic, B may have at most V i 1 edges within a component V i. A has exactly V i 1 edges in every set V i k Therefore, B contains at most ( V i 1) = A edges within a i=1 component V i. As A < B, there is an edge e B connecting two different components V i, V j. e cannot generate a cycle in A. It follows that A {e} U. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 12
13 Pairwise different edge costs For simplicity, we assume pairwise different edge costs and eliminate this assumption later. Cut Property: An edge e is definitely part of an MST, if it is the edge with minimum cost in a cut induced by a non-trivial set S. Therefore, it might be safely inserted. Cycle Property: Let C be an arbitrary cycle in G, and let e be the edge of maximum cost in C. Then, no MST contains e. Therefore, it might be safely removed. Proof by means of an exchange property: Every edge e in T that has not minimum cost with respect to the cut δ(s) might be replaced by an edge e δ(s) with c e < c e yielding a spanning tree with less cost. Analogously done for the cycles. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 13
14 Pairwise different edge costs (cont d) We have assumed pairwise different edge costs for all edges in E. How is it possible to conclude that the algorithms are still correct even if some edge costs are identical? Idea: modify edge costs by very small amounts δ such that all edge costs are pairwise different. The modification must be small enough in order to not change the relative ordering of edges that originally had different costs. The modification is only used as a tie-breaker for identical edge costs. If a tree T is more expensive than a tree T with respect to its original costs then it is more expensive for the modified costs and vice versa. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 14
15 Duality of blue rule and red rule Observation 8 The blue rule is the dual of the red rule and vice versa. Declarative Programming: minimize e E:e is blue c e s.t. {e E : e is blue} is a tree s.t. maximize e E:e is red c e {e E : e is not red} is a tree Note: These are not dual Linear Programs. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 15
16 Blue rule or red rule? An MST contains n 1 edges, usually this is a very small subset of the edges from E. Regarding a complete graph K n, there are ( n 2) O(n 2 ) edges. The blue rule labels exactly n 1 edges blue O(n). The red rule labels up to ( n 2) (n 1) edges red O(n 2 ). There are no efficient algorithms based on the red rule. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 17
17 Borůvka s Algorithm Borůvka s algorithm is believed to be the first MST algorithm (1926). It uses exclusively the blue rule, but slightly modified. Borůvka(G, c) 1. Initialize n trivial blue trees consisting of one node each. 2. As long as there is more than one blue tree, for each of the blue trees choose the minimally incident edge and label it blue. 3. The blue edges form an MST. Note that the above algorithm will only work with pairwise different edge weights c e. Otherwise cycles might occur. Clearly, specifying an ordering of edges of same weight with the above modification will help in this case. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 18
18 Borůvka Example Blue edges are tree edges. A directed edge means the target component has been chosen from a source component during an iteration. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 19
19 Correctness of Borůvka s Algorithm Regard an arbitrary edge e = (v, w), that is inserted into T during an iteration of Borůvka s algorithm. Let S be the node set that is accessible from v by edges from T shortly before e is inserted It is v S and w V \ S (otherwise a cycle would emerge by adding e). No edge from the cut between S und V \ S has been regarded so far. Otherwise, it would have been inserted without generating a cycle. As e is the cheapest edge from the cut δ(s), it is inserted correctly due to the cut property. The output T does not contain any cycles, because in Step 2 cycles are explicitly avoided. (V, T ) is connected: as G is connected, there would be at least one edge e in G between two different trees from (V, T ). The algorithm would have inserted that one with minimum cost. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 20
20 Kruskal s Algorithm (1956) Idea: Start with an empty edge set and successively add edges by increasing edge costs in such way no cycles emerge. Kruskal(G, c) 1. Initialize n blue trees consisting of one node each. 2. Sort E = {e 1, e 2,..., e m } increasingly: c e1 c e2 c em. 3. FOR i = 1 TO m DO IF the endnodes u and v of e i = (u, v) are in the same tree THEN label e i red ELSE label e i blue 4. The blue edges form an MST T. Alternative Step 3: FOR i = 1 TO m DO IF T {e i } does not contain a cycle THEN T := T {e i } Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 21
21 Kruskal Example Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 22
22 Correctness of Kruskal s Algorithm Regard an arbitrary edge e = (v, w), that is inserted into T during an iteration of Kruskal s algorithm. Let S be the node set that is accessible from v by edges from T shortly before e is inserted It is v S and w V \ S (otherwise a cycle would emerge by adding e). No edge from the cut between S und V \ S has been regarded so far. Otherwise, it would have been inserted without generating a cycle. As e is the cheapest edge from the cut δ(s), it is inserted correctly due to the cut property. The output T does not contain any cycles, because in every iteration cycles are explicitly avoided. (V, T ) is connected: as G is connected, there would be at least one edge e in G between two connected components from (V, T ). The algorithm would have inserted that one with minimum cost. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 23
23 Reverse Kruskal Reverse-Kruskal(G, c) 1. Label all edges in E blue. I.e. set (T := E). 2. Sort E = {e 1, e 2,..., e m } decreasingly: c e1 c e2 c em. 3. FOR i = 1 TO m DO IF T \ {e i } is connected THEN label e i red. 4. The blue edges form an MST T. The above procedure is also called Dual Kruskal due to duality of the blue and red rule. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 24
24 Correctness of Reverse Kruskal Regard an arbitrary edge e = (v, w) that is removed during the algorithm At the time of removal, e is part of a cycle C. Amongst all edges within C, e is the first edge to consider, that is e is the most expensive edge on C Due to the cycle property, the removal has been done deservedly. The output T of the algorithm T is connected due to the fact that at no time an edge is removed from T that would destroy connectivity (only edges from cycles are removed). In the end, T does not contain a cycle anymore because the most expensive edge on this cycle would have been removed. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 25
25 Implementation of Kruskal s Algorithm (1) Kruskal s Algorithm has an obvious invariant: the edge set T reflects a forest in G at any time of the algorithm. Obviously, the time critical operation is the test, if a cycle emerges in T {e i } by the insertion of an edge e i into T. A cycle emerges if and only if for en edge e i = (u, v), the two nodes u and v are part of the same connected component of T. We already know techniques to efficiently compute the connected components of a graph: BFS and DFS. These have linear complexity O(m + n). If we had to compute the CCs in every iteration of Kruskal s algorithm from scratch, this would amount to a total complexity of O(m 2 ). In order to avoid this, we would like to make use of a data structure that supports the operations of the algorithm efficiently. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 26
26 Implementation of Kruskal s Algorithm (2) We would like to make use of a data structure that supports the following operations efficiently: Given a set of nodes V of fixed size, and an edge set T that increases stepwise: in every step, an edge is inserted into T. At no time, an edge is removed from T. During the rise of T, we would like to know the connected components in every iteration. That is, for every node v V, we would like to compute its connected component efficiently. If we identify u and v to be part of two separate connected components, we would like to merge these components efficiently by insertion of an edge e = (v, w). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 27
27 Complexity of MST Algorithms Sorting edges according to their weights: O(m log m) e.g. Quicksort. Testing for cycles amounts to the test whether two nodes are in different connected components, or not. Ideas: Test: for every node, get efficiently the connected component it belongs to. Merge: always move the component of smaller size into the component of larger size. Hence, every component (or single node) is merged into a component of at least twice the size. Hence, every node is moved between components at most log n times. Thus, we have O(n log n) for cycle testing, that is also O(m log m) (see below). Can be done more efficiently by advanced Disjoint-Set / Union-Find data structures (in nearly linear time). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 28
28 Complexity of MST Algorithms (cont d) As m > n 2 in connected graphs holds, we can estimate n by m. As m < n 2, it is log m < log n 2 = 2 log n = O(log n). Therefore, the total cost is O(m log m), or O(m log n), respectively. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 29
29 Prim s Algorithm Jarnik (1930), Prim (1956), Dijkstra (1959) Idea: Start from an arbitrary node. In every step, grow the tree by inserting the node producing minimal cost. Prim(G, c, s) 1. Initialize n blue trivial trees (single nodes). Choose start node s. 2. WHILE trivial blue trees exist DO choose an edge of minimal weight from the cut that is induced by the nodes of the tree that contains s. Label it blue. 3. The blue edges form an MST T. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 30
30 Correctness of Prim s Algorithm During the WHILE loop, let S be the set of nodes, that are not trivial trees. In every iteration, the algorithms adds the edge e and a node w to the tree T such that c e is minimal from all edges e = (v, w) mit v S und w S. According to the cut property, e is part of any MST. It is easy to see that, eventually, a spanning tree is generated. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 31
31 Implementation of Prim s Algorithm In every iteration, it is crucial to efficiently decide which node to insert into the tree. (similar to Dijkstra s Algorithm) Amongst all nodes that are not part of the tree, we search for the one that might be connected with the tree by an edge with minimum cost. Therefore, it is convenient to save for every node that is not part of the tree the best possible cost of an insertion. We save this value as a key in every node. If the node cannot be connected with the tree by means of a connecting edge, we set the key to + (e.g. MAX_INT, etc.). In every iteration, we have to find a node that is not part of the tree with minimum key. This node is inserted. Then, the key values have to be updated. This task is supported by a specific data structure, a priority queue. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 32
32 Priority queues A priority queue Q is an abstract data structure managing a set of objects of type T. Every element in Q has a key of an ordered number type NT (N, Z,...) A priority queue supports the following operations: void create-pq(): create an empty priority queue Q void insert(t & x, NT y): insert the element x with key value y = key[x] into Q. T& find-min(): find the element x with the lowest key value and return reference to it. void delete-min(): remove the element with smallest key value from Q. void decrease-key(t x, NT y): decrease the key value of x to the new value Wert y. (Precondition: key[x] > y) bool empty(): returns TRUE if Q is empty. Annotation: Analogously, the data structure might deliver the element with the largest key value. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 33
33 Implementation of Prim s Algorithm Prim s Algorithm using a priority queue Q Prim (G = (V, E), c, s) (1) FORALL v V DO (2) key[v] = ; (3) pred[v] = null; // predecessor of v in the MST (4) key[s] = 0; (5) PriorityQueue Q.create-pq(); (6) FORALL v V DO (7) Q.insert (v, key[v]); (8) WHILE!Q.empty() DO (9) v = Q.find-min(); Q.delete-min(); (10) FORALL u Adj[v] DO (11) IF u Q und c({v, u}) < key[u] THEN (12) pred[u] = v; (13) key[u] = c({v, u}); (14) Q.decrease-key(u, key[u]); Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 34
34 Complexity of Prim s Algorithm lines (1)-(3): Initialization in O(n) lines (4) and (5) in O(1) lines (6) and (7): n insert-operations line (8): exactly n passes through the loop line (9): in total n find-min- und delete-min-operations lines (10) - (14): every edge is touched once, that is O(m) + m decrease-key-operations. line (11): the test if u Q can be done in O(1) with a boolean auxiliary array (must be updated upon insertion / deletion). If we implement the priority queue as a binary heap, the find-min-operations might be done in O(1), the insert-, delete-min- and decrease-key-operations in O(log n) each. In total, this amounts to a complexity of O(m log n). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 35
35 Round Robin Algorithm The Round Robin Algorithm is the most efficient approach to the computation of MSTs in sparse graphs. It is based on the blue rule and quite similar to Borůvka s algorithm. Round-Robin(G, c) 1. Initialize n blue trees consisting of one node each. 2. As long as there are less than n 1 blue edges, choose a blue tree T, compute the edge e of minimum cost in δ(t ) and label it blue. 3. The blue edges form an MST. It can be implemented to run in O(m log log n): in every iteration, we choose the blue tree with the least number of nodes. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 36
36 MST Runtimes Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 37
37 MST Algorithms Complexity Deterministic comparison based MST algorithms Algorithm Complexity Jarnik, Prim, Dijkstra, Kruskal, Boruvka O(m log n) Cheriton-Tarjan (1976), Yao (1975) O(m log log n) Fredman-Tarjan (1987) O(mβ(m, n)) Gabow-Galil-Spencer-Tarjan (1986) O(m log β(m, n)) Chazelle (2000) O(mα(m, n)) The holy grail would be O(m). Notable approaches Dixon-Rauch-Tarjan (1992) Karger-Klein-Tarjan (1995) O(m) verification O(m) randomized On planar graphs possible in O(m). Parallel algorithms with linear number of processors in O(log n). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 38
38 An Application: 1-trees MSTs might be used for the computation of lower bounds on the optimal length of TSP tours. A Hamilton tour T is defined as follows: The degree of the start node w.r.t. T is 2. T is an MST for the nodes {2, 3,..., n}. The degree of nodes {2, 3,..., n} w.r.t. T is 2. Dropping the last condition, and computing a minimal edge set satisfying the first two conditions, we obviously get a lower bound on the length of a shortest tour. Such edge sets are also called 1-trees. Onetree(G, c) 1. Compute an MST for the node set {2, 3,..., n}. Let c T be its cost. 2. Let e 1 be the shortest and e 2 be the second shortest edge in G incident with node T {e 1, e 2 } is an optimal 1-tree of value c T + c e1 + c e2. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 39
39 Part II The directed case: Maximum Branchings Clearly, Minimum Branching would not make any sense with positive edge weights as the forests would be empty. Maximum Branching Given a digraph D = (V, A) with edge weights c e for each e A. We search for a branching B A of D that maximizes c e. Recall: A branching B A is an edge set such that in the directed acyclic graph (DAG) given by (V, B), it is δ (v) 1 for all v V. Idea 1 e B Sort edges by decreasing weight and use Kruskal s algorithm: add edges of maximum weight always preserving the branching property (no cycles, δ (v) 1 for all v B). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 40
40 Maximum Branchings Bad idea! Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 41
41 Delayed Decision Idea 2: Reduce Complexity by Delayed Decision Fundamental technique for the solution of complex problems: Postpone critical decisions to a point in time you are able to make them irreversibly by transforming the original problem into easier problems by applying smart reduction techniques. generating a solution to the original problem from the (greedy) solutions of the reduced problems. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 43
42 Edmonds Branching Algorithm Some terminology s : A V determines the start node of an edge e A. t : A V determines the end node of an edge e A. c : A R determines the weight of an edge e A. u B v means: there is a directed u-v-path in B. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 44
43 Critical Graphs Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 45
44 Critical Graphs (2) Definition 9 (Critical edge / subgraph) Let D = (V, A) be a directed graph with edge weights c e = c(e), e A. (a) An edge e A is called critical, if c(e) > 0 and t(e ) = t(e) c(e ) c(e), for all e A. (b) A subgraph H D is called critical, if it consists exclusively of critical edges, and every node is an end node of at most one of these edges, and H is maximal by inclusion w.r.t. this property. Lemma 10 An acyclic critical graph H is a maximal branching. Proof. Obviously, H is a branching. Let B be an arbitrary branching. For every node v V, we have c(b {e t(e) = v}) c(h {e t(e) = v}). Summing up over v V, it is c(b) c(h). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 46
45 Critical Graphs (3) Lemma 11 Let H be a critical graph. Every node of H is part of at most one cycle. Proof. Consider an edge e. We assume there are 2 cycles containing e. Then there must be a node u with δ (u) > 1. This contradicts the definition. Lemma 12 Let B be a branching, and u, v, w three nodes. If u B v and w B v, then it is either u B w, or w B u. Proof. W.l.o.g., let u B v the shorter path. Then, w B v must contain all edges of this path. Otherwise, one node would be the end node of two edges. Therefore, it is w B u B v. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 47
46 Critical Graphs (4) Definition 13 Let B be a branching, and e / B. e is called feasible w.r.t. B, if B := B {e} \ {f f B and t(f ) = t(e)} is a branching as well. Lemma 14 Let B be a branching, and e A \ B. Then, e is feasible w.r.t. B if and only if there is no path from t(e) to s(e) in B. Proof. If and only if the insertion of e generates a cycle, B is not a branching. In this case, there must be a path from t(e) to s(e) in B. Lemma 15 Let B be a branching, and C A a cycle with the following property: there is no feasible edge from C \ B w.r.t. B. Then, it is C \ B = 1. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 48
47 Critical Graphs (5) Proof. Clearly, C \ B > 0, because a branching does not contain any cycle. For contradiction, we assume that C \ B = k 2. Let C \ B = {e 1, e 2,..., e k }, where the e i occur in this order within C. As there is no feasible e i, there are paths t(e i ) B s(e i ) (cf. Lemma 12). Upon assumption, we have t(e i 1 ) s(e i ). From Lemma 10, it follows that B either t(e i 1 ) t(e i ), or t(e i ) t(e i 1 ). B B Let t(e i 1 ) B t(e i ) B s(e i ). The path t(e i 1 ) B s(e i ) is unique and completely contained in C (by assumption). Therefore, it is t(e i 1 ) t(e i ) s(e i ). This is impossible as another edge B C B C e j e i would exist with end node t(e j ) = t(e i ) C as (s(e i ), t(e i )) is not part of that path. For this reason, it is t(e i ) t(e i 1 ), i = 2,..., k, and t(e 1) t(e k ). B B Hence, B contains a cycle t(e k ) B t(e k 1 ) B... B t(e 1) B t(e k ). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 49
48 Critical Graphs (6) Corollary 16 For a branching B and a cycle C the following holds: either an edge e i C is feasible w.r.t. B, or B contains all edges of C but one. Theorem 17 Let H be a critical graph. Then, there is a branching B of maximal weight, such that for any cycle C H holds that C \ B = 1. Proof. Let B be a maximum branching that contains as many edges as possible from H. Consider a critical edge e H \ B: If there is no e B with t(e) = t(e ), we could increase the number of edges from H in B by simply adding e. This yields a branching B containing more edges of H than B. Then either B was not maximal, or B contains a circuit. If there is an e B with t(e) = t(e ): if e is feasible, exchanging e by e would deliver a maximum branching B with more edges from H than B has. This contradicts the above construction of B. It follows that there is no feasible edge e H \ B. In particular, for any cycle C H, no edge e C \ B is feasible. With the above Lemma, it follows C \ B = 1 for any cycle C in H. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 50
49 Critical Graphs (7) In the following, we denote by C 1, C 2,..., C k the (node disjoint) cycles of the critical graph H. From any of these cycles, we choose an edge of minimal weight a 1, a 2,..., a k. By V i = V (C i ), we denote the nodes of cycle C i. Corollary 18 Let D = (V, A) be a digraph with edge weights c e, and H a critical graph with cycles C i,..., C k. Then, there is a maximum branching B such that: (a) C i \ B = 1, for all i = 1,..., k. (b) If for any edge e B \ C i holds that t(e) / V i, then it is C i \ B = {a i }. Proof. (a) holds (cf. Theorem 15). Let B be a maximal branching with the minimum number of edges a i. We show, that (b) follows if (a) holds: If (b) does not hold, there is a cycle C i with t(e) / V i for all edges e B \ C i, but a i B. Then, a i could be exchanged by any other edge from the cycle C i preserving maximality. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 51
50 Critical Cycles , and Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 52
51 Shrinking critical cycles Let H be the critical graph of D with cycles C 1, C 2,..., C k. Let Ṽ be the set of nodes outside any cycle. For any v V i, let ẽ(v) be the edge within C i with end node v. We construct a new instance in D = ( V, Ā) with functions s, t, and c as follows: V := Ṽ {w 1, w 2,..., w k }, w i are pseudo-nodes replacing a cycle C i. Ā := A(Ṽ ) = A \ k A(V (C i )) (edges from outside any cycle). i=1 Edges are generated according to the following rules: s(e) := { s(e), if s(e) Ṽ, w i, if s(e) V i, t(e) := { t(e), if t(e) Ṽ, w i, if t(e) V i, { c(e), if t(e) Ṽ, c(e) := c(e) c(ẽ(t(e))) + c(a i ) if t(e) V i. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 53
52 Shrinking Example W2 4 W There are two critical cycles: C 1 (blue), and C 2 (red). It is a 1 the edge (4, 3), and a 2 the edge (2, 0). Let e be the edge (2, 1). Then, c(e) := c(e) c(ẽ(t(e))) + c(a 1 ) = 3 c(ẽ(1)) + 4 = = 2. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 54
53 Branching correspondence Let B be the set of branchings in the original graph D that satisfy (a) and (b) from Corollary 16. That is, these branchings contain all edges from critical cycles but one. If possible, the shortest edge is missing. These branchings are not necessarily optimal. For example, every branching in a DAG satisfies (a) and (b). Theorem 19 There is a bijective transformation between B and the set of branchings in D. In particular, a branching B B corresponds to a branching B := B Ā in D, and it holds k k c(b) c( B) = c(c i ) c(a i ). Therefore, an optimal branching in D is also optimal in D. i=1 i=1 Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 55
54 Edmonds Algorithm (1967) Edmonds fundamental idea Shrink critical cycles and adjust the edge weights in the above manner until the graph is acyclic. Choose branching edges and extract pseudo nodes to the next higher level. Never revise choice of edges made in a lower level, instead choose edges within critical cycles according to that choice. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 56
55 Edmonds Algorithm (1967) Edmonds(D, c) 1. Compute a critical graph H D. 2. If H is acyclic, return H (H is an optimal branching). 3. Shrink the cycles in H to obtain D and c. 4. Recursively compute an opt. branching B for D by calling Edmonds( D, c) 5. Expand B to an optimal branching B for D. An efficient implementation is not trivial. There are O(mn), O(m log n), and O(m + n log n) implementations. Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 57
56 Example Phase 1: Shrink 1) 2) W W W ) W4-1 3 Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 58
57 Example Phase 2: Expand 3) 2) W W ) W W4 3 Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 59
58 Concluding Annotations Regarding parallel edges in the shrunk graph, only the one of highest weight is relevant. Zero or negative weight edges might be immediately eliminated. During expansion, edges choosen at a less expanded level are always kept (cf. Theorems 15,17). Application: Edmonds algorithm might be used to compute 1-arborescences: Analogously to the 1-tree lower bound for the TSP, these might be used as lower bounds for the asymmetric TSP (ATSP). Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 60
59 Selected Literature Edmonds, J.: Optimum Branchings, J. Res. Nat. Bur. Standards, vol. 71B, 1967, Tarjan, R. E.: Finding Optimum Branchings, Networks, v.7, 1977, Karger, D. R., Klein, P. N., and Tarjan, R. E.: A randomized linear-time algorithm to find minimum spanning trees, JACM 42, 2 (Mar. 1995), Chazelle, B.: A minimum spanning tree algorithm with inverse-ackermann type complexity, JACM 47, 6 (Nov. 2000), Pettie, S. and Ramachandran, V.: An optimal minimum spanning tree algorithm, JACM 49, 1 (Jan. 2002), Bader, D. A. and Cong, G.: Fast shared-memory algorithms for computing the minimum spanning forest of sparse graphs, J. Parallel Distrib. Comput. 66, 11 (Nov. 2006), Efficient Graph Algorithms Wolfgang Stille WS 2011/2012 Chapter III - Optimal Trees and Branchings 61
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 informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.5 Minimum Spanning Tree Minimum Spanning Tree Minimum spanning tree. Given a connected
More informationAlgorithms 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 informationMinimum-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 informationMinimum Spanning Trees
Chapter 23 Minimum Spanning Trees Let G(V, E, ω) be a weighted connected graph. Find out another weighted connected graph T(V, E, ω), E E, such that T has the minimum weight among all such T s. An important
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.5 Minimum Spanning Tree Minimum Spanning Tree Minimum spanning tree. Given a connected
More information22 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 information22 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 informationWe ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding
We ve done Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding Matroid Theory Now Matroids and weighted matroids Generic
More information2 A Template for Minimum Spanning Tree Algorithms
CS, Lecture 5 Minimum Spanning Trees Scribe: Logan Short (05), William Chen (0), Mary Wootters (0) Date: May, 0 Introduction Today we will continue our discussion of greedy algorithms, specifically in
More informationMinimum Spanning Trees
Minimum Spanning Trees Minimum Spanning Trees Representation of Weighted Graphs Properties of Minimum Spanning Trees Prim's Algorithm Kruskal's Algorithm Philip Bille Minimum Spanning Trees Minimum Spanning
More informationMinimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees
Properties of Properties of Philip Bille 0 0 Graph G Not connected 0 0 Connected and cyclic Connected and acyclic = spanning tree Total weight = + + + + + + = Applications Network design. Computer, road,
More informationDecreasing 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 information1 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 information4. GREEDY ALGORITHMS II
4. GREEDY ALGORITHMS II Dijkstra s algorithm minimum spanning trees Prim, Kruskal, Boruvka single-link clustering min-cost arborescences Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley
More informationAlgorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree
Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A
More informationAlgorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree
Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A
More informationCSE 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 informationmanaging 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 informationGreedy 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 informationCSE 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 informationMinimum cost spanning tree
Minimum cost spanning tree Doctoral course Optimization on graphs - Lecture 2.2 Giovanni Righini January 15 th, 2013 Definitions - 1 A graph G = (V,E) is a tree if and only if it is connected and acyclic.
More informationThe minimum cost spanning tree problem
The minimum cost spanning tree problem Combinatorial optimization Giovanni Righini Definitions - 1 A graph G = (V,E) is a tree if and only if it is connected and acyclic. Connectivity: for each cut, at
More informationAdvanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret
Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.5 Minimum Spanning Tree Minimum Spanning Tree Minimum spanning tree. Given a connected
More informationThese are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions.
CSE 591 HW Sketch Sample Solutions These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions. Problem 1 (a) Any
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.5 Minimum Spanning Tree Minimum Spanning Tree Minimum spanning tree. Given a connected
More informationCS521 \ 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 informationCS 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 informationCIS 121 Data Structures and Algorithms Minimum Spanning Trees
CIS 121 Data Structures and Algorithms Minimum Spanning Trees March 19, 2019 Introduction and Background Consider a very natural problem: we are given a set of locations V = {v 1, v 2,..., v n }. We want
More informationChapter 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 information11/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 informationCSE 521: Design and Analysis of Algorithms I
CSE 521: Design and Analysis of Algorithms I Greedy Algorithms Paul Beame 1 Greedy Algorithms Hard to define exactly but can give general properties Solution is built in small steps Decisions on how to
More informationRepresentations 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 informationNotes on Minimum Spanning Trees. Red Rule: Given a cycle containing no red edges, select a maximum uncolored edge on the cycle, and color it red.
COS 521 Fall 2009 Notes on Minimum Spanning Trees 1. The Generic Greedy Algorithm The generic greedy algorithm finds a minimum spanning tree (MST) by an edge-coloring process. Initially all edges are uncolored.
More informationAdvanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012
topological ordering, minimum spanning tree, Union-Find problem Jiří Vyskočil, Radek Mařík 2012 Subgraph subgraph A graph H is a subgraph of a graph G, if the following two inclusions are satisfied: 2
More information1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m
Minimum Spanning Trees (MST) 8 0 e 7 b 3 a 5 d 9 h i g c 8 7 6 3 f j 9 6 k l 5 m A graph H(U,F) is a subgraph of G(V,E) if U V and F E. A subgraph H(U,F) is called spanning if U = V. Let G be a graph with
More informationMinimum Spanning Trees Ch 23 Traversing graphs
Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs
More informationMinimum 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 informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.5 Minimum Spanning Tree Minimum Spanning Tree Minimum spanning tree. Given a connected
More informationLecture 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 information5 MST and Greedy Algorithms
5 MST and Greedy Algorithms One of the traditional and practically motivated problems of discrete optimization asks for a minimal interconnection of a given set of terminals (meaning that every pair will
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 05 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction
More informationMinimum Spanning Trees
Course Trees - the ubiquitous structure in computer science and mathematics, JASS 08 Minimum Spanning Trees Maximilian Schlund Fakultät für Informatik TU München April 20, 2008 Maximilian Schlund: Minimum
More information5 MST and Greedy Algorithms
5 MST and Greedy Algorithms One of the traditional and practically motivated problems of discrete optimization asks for a minimal interconnection of a given set of terminals (meaning that every pair will
More informationChapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 9 Greedy Technique Copyright 2007 Pearson Addison-Wesley. All rights reserved. Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that
More informationDiscrete mathematics
Discrete mathematics Petr Kovář petr.kovar@vsb.cz VŠB Technical University of Ostrava DiM 470-2301/02, Winter term 2018/2019 About this file This file is meant to be a guideline for the lecturer. Many
More information2pt 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 informationGreedy Algorithms Part Three
Greedy Algorithms Part Three Announcements Problem Set Four due right now. Due on Wednesday with a late day. Problem Set Five out, due Monday, August 5. Explore greedy algorithms, exchange arguments, greedy
More informationChapter 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 informationChapter 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 informationMinimum 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 informationMinimum Spanning Trees
CSMPS 2200 Fall Minimum Spanning Trees Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 11/6/ CMPS 2200 Intro. to Algorithms 1 Minimum spanning trees Input: A
More information4. GREEDY ALGORITHMS II
4. GREEDY ALGORITHMS II Dijkstra s algorithm minimum spanning trees Prim, Kruskal, Boruvka single-link clustering min-cost arborescences Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley
More informationDijkstra s algorithm for shortest paths when no edges have negative weight.
Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm
More informationDesign and Analysis of Algorithms
CSE 101, Winter 2018 Design and Analysis of Algorithms Lecture 9: Minimum Spanning Trees Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ Goal: MST cut and cycle properties Prim, Kruskal greedy algorithms
More informationGraphs 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 informationWeek 12: Minimum Spanning trees and Shortest Paths
Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601
More informationCOP 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 informationMatching 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 informationUNIT 3. Greedy Method. Design and Analysis of Algorithms GENERAL METHOD
UNIT 3 Greedy Method GENERAL METHOD Greedy is the most straight forward design technique. Most of the problems have n inputs and require us to obtain a subset that satisfies some constraints. Any subset
More informationTheorem 2.9: nearest addition algorithm
There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used
More informationChapter 23. Minimum Spanning Trees
Chapter 23. Minimum Spanning Trees We are given a connected, weighted, undirected graph G = (V,E;w), where each edge (u,v) E has a non-negative weight (often called length) w(u,v). The Minimum Spanning
More informationIntroduction to Algorithms
Introduction to Algorithms, Lecture 1 /1/200 Introduction to Algorithms.04J/1.401J LECTURE 11 Graphs, MST, Greedy, Prim Graph representation Minimum spanning trees Greedy algorithms hallmarks. Greedy choice
More informationTopics on Computing and Mathematical Sciences I Graph Theory (3) Trees and Matchings I
Topics on Computing and Mathematical Sciences I Graph Theory (3) Trees and Matchings I Yoshio Okamoto Tokyo Institute of Technology April 23, 2008 Y. Okamoto (Tokyo Tech) TCMSI Graph Theory (3) 2008-04-23
More informationData Structures and Algorithms. Werner Nutt
Data Structures and Algorithms Werner Nutt nutt@inf.unibz.it http://www.inf.unibz/it/~nutt Chapter 10 Academic Year 2012-2013 1 Acknowledgements & Copyright Notice These slides are built on top of slides
More informationMinimum Spanning Trees
Minimum Spanning Trees 1 Minimum- Spanning Trees 1. Concrete example: computer connection. Definition of a Minimum- Spanning Tree Concrete example Imagine: You wish to connect all the computers in an office
More informationRandomized 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 informationGraphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs
Graphs and Network Flows IE411 Lecture 21 Dr. Ted Ralphs IE411 Lecture 21 1 Combinatorial Optimization and Network Flows In general, most combinatorial optimization and integer programming problems are
More informationMinimum Spanning Trees Shortest Paths
Minimum Spanning Trees Shortest Paths Minimum Spanning Tree Given a set of locations, with positive distances to each other, we want to create a network that connects all nodes to each other with minimal
More informationThe Encoding Complexity of Network Coding
The Encoding Complexity of Network Coding Michael Langberg Alexander Sprintson Jehoshua Bruck California Institute of Technology Email: mikel,spalex,bruck @caltech.edu Abstract In the multicast network
More information23.2 Minimum Spanning Trees
23.2 Minimum Spanning Trees Kruskal s algorithm: Kruskal s algorithm solves the Minimum Spanning Tree problem in O( E log V ) time. It employs the disjoint-set data structure that is similarly used for
More informationMinimum Spanning Trees and Prim s Algorithm
Minimum Spanning Trees and Prim s Algorithm Version of October 3, 014 Version of October 3, 014 Minimum Spanning Trees and Prim s Algorithm 1 / 3 Outline Spanning trees and minimum spanning trees (MST).
More informationReference 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 informationUndirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1
Undirected Graphs Terminology. Free Trees. Representations. Minimum Spanning Trees (algorithms: Prim, Kruskal). Graph Traversals (dfs, bfs). Articulation points & Biconnected Components. Graph Matching
More informationChapter 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 informationTrees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.
Trees 1 Introduction Trees are very special kind of (undirected) graphs. Formally speaking, a tree is a connected graph that is acyclic. 1 This definition has some drawbacks: given a graph it is not trivial
More informationCSE331 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 informationGreedy Approach: Intro
Greedy Approach: Intro Applies to optimization problems only Problem solving consists of a series of actions/steps Each action must be 1. Feasible 2. Locally optimal 3. Irrevocable Motivation: If always
More informationWeek 11: Minimum Spanning trees
Week 11: Minimum Spanning trees Agenda: Minimum Spanning Trees Prim s Algorithm Reading: Textbook : 61-7 1 Week 11: Minimum Spanning trees Minimum spanning tree (MST) problem: Input: edge-weighted (simple,
More informationMinimum Spanning Trees COSC 594: Graph Algorithms Spring By Kevin Chiang and Parker Tooley
Minimum Spanning Trees COSC 594: Graph Algorithms Spring 2017 By Kevin Chiang and Parker Tooley Test Questions 1. What is one NP-Hard problem for which Minimum Spanning Trees is a good approximation for?
More informationLecture Summary CSC 263H. August 5, 2016
Lecture Summary CSC 263H August 5, 2016 This document is a very brief overview of what we did in each lecture, it is by no means a replacement for attending lecture or doing the readings. 1. Week 1 2.
More informationIn this lecture, we ll look at applications of duality to three problems:
Lecture 7 Duality Applications (Part II) In this lecture, we ll look at applications of duality to three problems: 1. Finding maximum spanning trees (MST). We know that Kruskal s algorithm finds this,
More informationCS 310 Advanced Data Structures and Algorithms
CS 0 Advanced Data Structures and Algorithms Weighted Graphs July 0, 07 Tong Wang UMass Boston CS 0 July 0, 07 / Weighted Graphs Each edge has a weight (cost) Edge-weighted graphs Mostly we consider only
More informationApproximation Algorithms
Chapter 8 Approximation Algorithms Algorithm Theory WS 2016/17 Fabian Kuhn Approximation Algorithms Optimization appears everywhere in computer science We have seen many examples, e.g.: scheduling jobs
More informationMinimum Spanning Trees
Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no
More informationLecture 13: Minimum Spanning Trees Steven Skiena
Lecture 13: Minimum Spanning Trees Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.stonybrook.edu/ skiena Problem of the Day Your job
More informationCS 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 informationSteiner Trees and Forests
Massachusetts Institute of Technology Lecturer: Adriana Lopez 18.434: Seminar in Theoretical Computer Science March 7, 2006 Steiner Trees and Forests 1 Steiner Tree Problem Given an undirected graph G
More informationSolutions for the Exam 6 January 2014
Mastermath and LNMB Course: Discrete Optimization Solutions for the Exam 6 January 2014 Utrecht University, Educatorium, 13:30 16:30 The examination lasts 3 hours. Grading will be done before January 20,
More information2.2 Optimal cost spanning trees
. Optimal cost spanning trees Spanning trees have a number of applications: network design (communication, electrical,...) IP network protocols compact memory storage (DNA)... E. Amaldi Foundations of
More informationCS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem
CS61: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem Tim Roughgarden February 5, 016 1 The Traveling Salesman Problem (TSP) In this lecture we study a famous computational problem,
More informationIndex. stack-based, 400 A* algorithm, 325
Index Abstract transitive closure, 174-175, 217-221 Active vertex, 411 Acyclic graph. See Digraph; Directed acyclic graph (DAG) Acyclic network, 313-321, 334-335 maxflow, 427-429 Adjacency-lists representation,
More informationlooking ahead to see the optimum
! Make choice based on immediate rewards rather than looking ahead to see the optimum! In many cases this is effective as the look ahead variation can require exponential time as the number of possible
More informationLecture 4: Primal Dual Matching Algorithm and Non-Bipartite Matching. 1 Primal/Dual Algorithm for weighted matchings in Bipartite Graphs
CMPUT 675: Topics in Algorithms and Combinatorial Optimization (Fall 009) Lecture 4: Primal Dual Matching Algorithm and Non-Bipartite Matching Lecturer: Mohammad R. Salavatipour Date: Sept 15 and 17, 009
More informationExample of why greedy step is correct
Lecture 15, Nov 18 2014 Example of why greedy step is correct 175 Prim s Algorithm Main idea:» Pick a node v, set A={v}.» Repeat: find min-weight edge e, outgoing from A, add e to A (implicitly add the
More informationG205 Fundamentals of Computer Engineering. CLASS 21, Mon. Nov Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm
G205 Fundamentals of Computer Engineering CLASS 21, Mon. Nov. 22 2004 Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm Greedy Algorithms, 1 Algorithms for Optimization Problems Sequence of steps Choices at
More informationLecture 13: Minimum Spanning Trees Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY
Lecture 13: Minimum Spanning Trees Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Problem of the Day Your job is to
More informationOutline. 1 The matching problem. 2 The Chinese Postman Problem
Outline The matching problem Maximum-cardinality matchings in bipartite graphs Maximum-cardinality matchings in bipartite graphs: The augmenting path algorithm 2 Let G = (V, E) be an undirected graph.
More informationDESIGN AND ANALYSIS OF ALGORITHMS GREEDY METHOD
1 DESIGN AND ANALYSIS OF ALGORITHMS UNIT II Objectives GREEDY METHOD Explain and detail about greedy method Explain the concept of knapsack problem and solve the problems in knapsack Discuss the applications
More information