# Greedy algorithms is another useful way for solving optimization problems.

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These solutions are called feasible solutions. (In general, there are many feasible solutions.) We have an optimization measure defined for each feasible solution. We are looking for a feasible solution that optimizes (either maximum or minimum) the optimization measure. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 1

2 Examples Matrix Chain Product Problem A feasible solution is any valid parenthesization of an n-term chain. The optimization measure is the total number of scalar multiplications for the parenthesization. Goal: Minimize the the total number of scalar multiplications. 0/1 Knapsack Problem A feasible solution is any subset of items whose total weight is at most the knapsack capacity K. The optimization measure is the total item profit of the subset. Goal: Maximize the the total profit. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 1

3 Greedy Algorithms General Description Given an optimization problem P, we seek an optimal solution. The solution is obtained by a sequence of steps. In each step, we select an item to be included into the solution. At each step, the decision is made based on the selections we have already made so far, that looks the best choice for achieving the optimization goal. Once a selection is made, it cannot be undone: The selected item cannot be removed from the solution. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 4 / 1

4 Minimum Spanning Tree (MST) Problem This is a classical graph problem. We will study graph algorithms in detail later. Here we use MST as an example of Greedy Algorithms. Definition A tree is a connected graph with no cycles. Definition Let G = (V, E) be a graph. A spanning tree of G is a subgraph of G that contains all vertices of G and is a tree. Minimum Spanning Tree (MST) Problem Input: An connected undirected graph G = (V, E). Each edge e E has a weight w(e) 0. Find: a spanning tree T of G such that w(t) = e T w(e) is minimum. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 5 / 1

5 Kruskal s Algorithm Kruskal s Algorithm 1: Sort the edges by non-decreasing weight. Let e 1, e 2,..., e m be the sorted edge list 2: T 3: for i = 1 to m do 4: if T {e i } does not contain a cycle then 5: T T {e i } 6: else 7: do nothing 8: end if 9: end for 10: output T c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 6 / 1

6 Kruskal s Algorithm The algorithm goes through a sequence of steps. At each step, we consider the edge e i, and decide whether add e i into T. Since we are building a spanning tree T, T can not contain any cycle. So if adding e i into T introduces a cycle in T, we do not add it into T. Otherwise, we add e i into T. We are processing the edges in the order of increasing edge weight. So when e i is added into T, it looks the best to achieve the goal (minimum total weight). Once e i is added, it is never removed and is included into the final tree T. This is a perfect example of greedy algorithms. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 7 / 1

7 An Example (5) (4) (1) 7 5 4(6) 2 (3) 1 (2) 6 The number near an edge is its weight. The blue edges are in the MST constructed by Kruskal s algorithm. The blue numbers in () indicate the order in which the edges are added into MST. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 8 / 1

8 Kruskal s Algorithm For a given graph G = (V, E), its MST is not unique. However, the weight of any two MSTs of G must be the same. In Kruskal s algorithm, two edges e i and e i+1 may have the same weight. If we process e i+1 before e i, we may get a different MST. Runtime of Kruskal s algorithm: Sorting of edge list takes Θ(m log m) time. Then we process the edges one by one. So the loop iterates m time. When processing an edge e i, we check if T {e i } contains a cycle or not. If not, add e i into T. If yes, do nothing. By using proper data structures, the processing of an edge e i can be done in O(log n) time. (The detail was discussed in CSE250). So the loop takes O(m log n) time. Since G is connected, m n. The total runtime is Θ(m log m + m log n) = Θ(m log m). c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 9 / 1

9 Elements of Greedy Algorithms Are we done? No! A big task is not done yet: How do we know Kruskal s algorithm is correct? Namely, how do we know the tree constructed by Kruskal s algorithm is indeed a MST? You may have convinced yourself that we are using an obvious strategy towards the optimization goal. In this case, we are lucky: our intuition is correct. But in other cases, the strategies that seem equally obvious may lead to wrong solutions. In general, the correctness of a greedy algorithm requires proof. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 11 / 1

10 Correctness Proof of Algorithms An algorithm A is correct, if it works on all inputs. If A works on some inputs, but not on some other inputs, then A is incorrect. To show A is correct, you must argue that for all inputs, A produces intended solution. To show A is incorrect, you only need to give a counter example input I: You show that, for this particular input I, the output from A is not the intended solution. Strictly speaking, all algorithms need correctness proof. For DaC, it s often so straightforward that the correctness proof is unnecessary/omitted. (Example: MergeSort) For dynamic programming algorithms, the correctness proof is less obvious than the DaC algorithms. But in most time, it is quite easy to convince people (i.e. informal proof) the algorithm is correct. For greedy algorithms, the correctness proof can be very tricky. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 12 / 1

11 Elements of Greedy Algorithms For a greedy strategy to work, it must have the following two properties. Optimal Substructure Property An optimal solution of the problem contains within it the optimal solutions of subproblems. This is the same property required by the dynamic programming algorithms. Greedy Choice Property A global optimal solution can be obtained by making a locally optimal choice that seems the best toward the optimization goal when the choice is made. (Namely: The choice is made based on the choices we have already made, not based on the future choices we might make.) This property is harder to describe exactly. Best way to understand it is by examples. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 13 / 1

12 Optimal Substructure Property for MST Example Optimal Substructure Property for MST Let G = (V, E) be a connected graph with edge weight. Let e 1 = (x, y) be the edge with the smallest weigh. (Namely, e 1 is the first edge chosen by Kruskal s algorithm.) Let G = (V, E ) be the graph obtained from G by merging x and y: x and y becomes a single new vertex z in G. Namely V = V {x, y} {z} e 1 is deleted from G. Any edge e i in G that was incident to x or y now is incident to z. The edge weights remain unchanged. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 14 / 1

13 Optimal Substructure Property for MST 2 a 2 a 3 d c 3 d 3 5 e 5 5 x 1 y 3 z c 4 4 b G G b 5 Optimal Substructure Property for MST If T is a MST of G containing e 1, then T = T {e 1 } is a MST of G. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 15 / 1

14 Greedy Choice Property for Kruskal s Algorithm Let e 1, e 2,..., e m be the edge list in the order of increasing weight. So e 1 is the first edge chosen by Kruskal s algorithm. Let T opt be an MST of G. By definition, the total weight of T opt is the minimum. We want to show T opt contains e 1. But this is not always possible. Recall that the MST of G is not unique. So we will do this: Starting from T opt, we change T opt, without increasing the weight in the process, to another MST T that contains e 1. If T opt contains e 1, then we are done (lucky!) c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 17 / 1

15 Greedy Choice Property for Kruskal s Algorithm Suppose T opt does not contain e 1. Consider the graph H = T opt {e 1 }. H contains a cycle C. Let e i e 1 be another edge on C. Let T = T opt {e i } {e 1 }. Then T is a spanning tree of G. Since e 1 is the edge with the smallest weight, w(e 1 ) w(e i ). Hence w(t ) = w(t opt ) w(e i ) + w(e 1 ) w(t opt ). But T opt is a MST! So we must have w(e i ) = w(e 1 ) and w(t opt ) = w(t ). In other words, both T opt and T are MSTs of G. This is what we want to show: There is an MST that contains e 1. So when Kruskal s algorithm includes e 1 into T, we are not making a mistake. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 18 / 1

16 Greedy Choice Property for Kruskal s Algorithm ei e 1 c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 19 / 1

17 Correctness Proof of Kruskal s Algorithm The proof is by induction. Kruskal s algorithm selects the lightest edge e 1 = (x, y). By Greedy Choice Property, there exists an optimal MST of G that contains e 1. By induction hypothesis, Kruskal s algorithm construct a MST T in the graph G = ((V {x, y} {z}), E ) which is obtained from G by merging the two end vertices x, y of e 1. By the Optimal Substructure Property of MST, T = T {e 1 } is a MST of G. This T is the tree constructed by Kruskal s algorithm. Hence, Kruskal s algorithm indeed returns a MST. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 20 / 1

18 0/1 Knapsack Problem We mentioned that some seemingly intuitive greedy strategies do not really work. Here is an example. 0/1 Knapsack Problem Input: n item i (1 i n). Each item i has an integer weight w[i] 0 and a profit p[i] 0. A knapsack with an integer capacity K. Find: A subset of items so that the total weight of the selected items is at most K, and the total profit is maximized. There are several greedy strategies that seem reasonable. But none of them works. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 22 / 1

19 0/1 Knapsack Problem Greedy Strategy 1 Since the goal is to maximize the profit without exceeding the capacity, we fill the items in the order of increasing weights. Namely: Sort the items by increasing item weight: w[1] w[2]. Fill the knapsack in the order item 1, item 2,... until no more items can be put into the knapsack without exceeding the capacity. Counter Example: n = 2, w[1] = 2, w[2] = 4, p[1] = 2, p[2] = 3, K = 4. This strategy puts item 1 into the knapsack with total profit 2. The optimal solution: put item 2 into the knapsack with total profit 3. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 23 / 1

20 0/1 Knapsack Problem For this greedy strategy, we can still show the Optimal Substructure Property holds: if S is an optimal solution, that contains the item 1, for the original input, then S {item 1 } is an optimal solution for the input consisting of item 2, item 3,, item n and the knapsack with capacity K w[1]. However, we cannot prove the Greedy Choice Property: We are not able to show there is an optimal solution that contains the item 1 (the lightest item). Without this property, there is no guarantee this strategy would work. (As the counter example has shown, it doesn t work.) c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 24 / 1

21 0/1 Knapsack Problem Greedy Strategy 2 Since the goal is to maximize the profit without exceeding the capacity, we fill the items in the order of decreasing profits. Namely: Sort the items by decreasing item profit: p[1] p[2]. Fill the knapsack in the order item 1, item 2,... until no more items can be put into the knapsack without exceeding the capacity. Counter Example: n = 3, p[1] = 3, p[2] = 2, p[3] = 2, w[1] = 3, w[2] = 2, w[3] = 2, K = 4. This strategy puts item 1 into the knapsack with total profit 3. The optimal solution: put item 2 and item 3 into the knapsack with total profit 4. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 25 / 1

22 0/1 Knapsack Problem Greedy Strategy 3 Since the goal is to maximize the profit without exceeding the capacity, we fill the items in the order of decreasing unit profit. Namely: Sort the items by decreasing item unit profit: p[1] w[1] p[2] w[2] p[3] w[1] Fill the knapsack in the order item 1, item 2,... until no more items can be put into the knapsack without exceeding the capacity. Counter Example: n = 2, w[1] = 2, w[2] = 4, p[1] = 2, p[2] = 3, K = 4. We have: p[1] w[1] = 2 2 = 1 p[2] w[2] = 3 4. This strategy puts item 1 into knapsack with total profit 2. The optimal solution: put item 2 into knapsack with total profit 3. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 26 / 1

23 Fractional Knapsack Problem Fractional Knapsack Problem Input: n item i (1 i n). Each item i has an integer weight w[i] 0 and a profit p[i] 0. A knapsack with an integer capacity K. Find: A subset of items to put into the knapsack. We can select a fraction of an item. The goal is the same: the total weight of the selected items is at most K, and the total profit is maximized. Mathematical description of Fractional Knapsack Problem Input: 2n + 1 integers p[1], p[2],, p[n], w[1], w[2],, w[n], K Find: a vector (x 1, x 2,..., x n ) such that: 0 x i 1 for 1 i n n i=1 x i w[i] K n i=1 x i p[i] is maximized. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 27 / 1

24 Fractional Knapsack Problem Although the Fractional Knapsack Problem looks very similar to the 0/1 Knapsack Problem, it is much much easier. The Greedy Strategy 3 works. Greedy-Fractional-Knapsack 1: Sort the items by decreasing unit profit: p[1] w[1] p[2] w[2] p[3] w[3] 2: i = 1 3: while K > 0 do 4: if K > w[i] then 5: x i = 1 and K = K w[i] 6: else 7: x i = K/w[i] and K = 0 8: end if 9: i = i : end while It can be shown the Greedy Choice Property holds in this case. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 28 / 1

25 Activity Selection Problem Activity Selection Problem A set S = {1, 2,..., n} of activities. Each activity i has a staring time s i and a finishing time f i (s i f i ). Two activities i and j are compatible if the interval [s i, f i ) and [s j, f j ) do not overlap. Goal: Select a subset A S of mutually compatible activities so that A is maximized. Application Consider a single CPU computer. It can run only one job at any time. Each activity i is a job to be run on the CPU that must start at time s i and finish at time f i. How to select a maximum subset A of jobs to run on CPU? c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 30 / 1

26 Greedy Algorithm for Activity Selection Problem Greedy Strategy At any moment t, select the activity i with the smallest finish time f i. Greedy-Activity-Selection 1: Sort the activities by increasing finish time: f 1 f 2 f n 2: A = {1} (A is the set of activities to be selected.) 3: j = 1 (j is the current activity being considered.) 4: for i = 2 to n do 5: if s i f j then 6: A = A {i} 7: j = i 8: end if 9: end for 10: return A c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 31 / 1

27 Example Input After Sorting Solid lines are selected activities Dashed lines are not selected [1, 3) is the first interval selected. The dashed intervals [0, 4) and [2, 6) are killed because they are not compatible with [1, 3). This problem is also called the interval scheduling problem. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 32 / 1

28 Proof of Correctness Let S = {1, 2,..., n} be the set of activities to be selected. Assume f 1 f 2 f n. Let O be an optimal solution. Namely O is a subset of mutually compatible activities and O is maximum. Let X be the output from the Greedy algorithm. We always have 1 X. We want to show O = X. We will do this by induction on n. Greedy Choice Property The activity 1 is selected by the greedy algorithm. We need to show there is an optimal solution that contains the activity 1. If the optimal solution O contains 1, we are done. If not, let k be the first activity in O. Let O = O {k} {1}. Since f 1 f k, all activities in O are still mutually compatible. Clearly O = O. So O is an optimal solution containing 1. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 33 / 1

29 Proof of Correctness By the Greedy Choice Property, we may assume the optimal solution O contains the job 1. Optimal Substructure Property Let S 1 = {i S s i f 1 }. (S 1 is the set of jobs that are compatible with job 1. Or equivalently, the set of jobs that are not killed by job 1.) Let O 1 = O {1}. Claim: O 1 is an optimal solution of the job set S 1. If this is not true, let O 1 be an optimal solution set of S 1. Since O 1 is not optimal, we have O 1 > O 1. Let O = O 1 {1}. Then O is a set of mutually compatible jobs in S, and O = O > O = O. But O is an optimal solution. This is a contradiction. Hence the claim is true. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 34 / 1

30 Proof of Correctness Jobs in S c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 35 / 1

31 Proof of Correctness Since the Optimal Substructure and Greedy Choice properties are true, we can prove the correctness of the greedy algorithm by induction. Greedy algorithm picks the job 1 in its solution. By the Greedy Choice property, there is an optimal solution that also contains the job 1. So this selection needs not be reversed. The greedy algorithm delete all jobs that are incompatible with job 1. The remaining jobs is the set S 1 in the proof of Optimal Substructure property. By induction hypothesis, Greedy algorithm will output an optimal solution X 1 for S 1. By the Optimal Substructure property, X = X 1 {1} is an optimal solution of the original job set S. X is the output from Greedy algorithm. So the algorithm is correct. Runtime: Clearly O(n log n) (dominated by sorting). c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 36 / 1

32 Scheduling All Intervals Schedule all activities using as few resources as possible. Input: A set R = {I 1,..., I n } of n requests/activities. Each I i has a start time s i and finish time f i. (So each I i is represented by an interval [s i, f i )). Output: A partition of R into as few subsets as possible, so that the intervals in each subset are mutually compatible. (Namely, they do not overlap.) c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 38 / 1

33 Scheduling All Intervals Application Each request I i is a job to be run on a CPU. If two intervals I p and I q overlap, they cannot run on the same CPU. How to run all jobs using as few CPUs as possible? I4 I1 I7 I5 I8 I6 I3 I c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 39 / 1

34 Scheduling All Intervals Another way to look at the problem: Color the intervals in R by different colors. The intervals with the same color do not overlap. Using as few colors as possible. I4 I2 I3 I1 I7 I5 I8 I This problem is also known as Interval Graph Coloring Problem. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 40 / 1

35 Scheduling All Intervals Graph Coloring Let G = (V, E) be an undirected graph. A vertex coloring of G is an assignment of colors to the vertices of G so that no two vertices with the same color are adjacent to each other in G. Equivalently, a vertex coloring of G is a partition of V into vertex subsets so that no two vertices in the same subset are adjacent to each other. I1 I2 I3 I4 I5 I6 I7 I8 A vertex coloring is also called just coloring of G. If G has a coloring with k colors, we say G is k-colorable. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 41 / 1

36 Scheduling All Intervals Graph Coloring Problem Input: An undirected graph G = (V, E) Output: Find a vertex coloring of G using as few colors as possible. Chromatic Number χ(g) = the smallest k such that G is k-colorable χ(g) = 1 iff G has no edges. χ(g) = 2 iff G is a bipartite graph with at least 1 edge. Graph Coloring is a very hard problem. The problem can be solved in poly-time only for special graphs. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 42 / 1

37 Scheduling All Intervals Four Color Theorem Every planar graph can be colored using at most 4 colors. G is a planar graph if it can be drawn on the plane so that no two edges cross. I1 I2 I3 I5 I6 I4 I7 I8 (a) (b) Both graphs (a) and (b) are planar graphs. The graph (a) has a 3-coloring. The graph (b) requires 4 colors, because all 4 vertices are adjacent to each other, and hence each vertex must have a different color. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 43 / 1

38 Scheduling All Intervals Interval Graph G = (V, E) is called an interval graph if it can be represented as follows: Each vertex p V represents an interval [b p, f p ). (p, q) E if and only if the two intervals I p and I q overlap. I4 I2 I3 I1 I5 I8 I7 I I1 I2 I3 I4 I5 I6 I7 I8 c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 44 / 1

39 Scheduling All Intervals It is easy to see that the problem of scheduling all intervals is precisely the graph coloring problem for interval graphs. We discuss a greedy algorithm for solving this problem. It is not easy to prove the greedy choice property for this greedy strategy. We show the correctness of the algorithm by other methods. We use queues Q 1, Q 2,... to hold the subsets of intervals. (You can think that each Q i is a CPU, and if an interval I p = [b p, f p ) is put into Q i, the job p is run on that CPU.) Initially all queues are empty. When we consider an interval [b p, f p ) and a queue Q i, we look at the last interval [b t, f t ) in Q i. If f t b p, we say Q i is available for [b p, f p ). (Meaning: the CPU Q i has finished the last job assigned to it. So it is ready to run the job [b p, f p ).) c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 45 / 1

40 Scheduling All Intervals Greedy-Schedule-All-Intervals 1 sort the intervals according to increasing b p value: b 1 b 2 b n 2 k = 0 (k will be the number of queues we need.) 3 for p = 1 to n do: 4 look at Q 1, Q 2,... Q k, put [b p, f p ) into the first available Q i. 5 if no current queue is available: increase k by 1; open a new empty queue; put [b p, f p ) into this new queue. 6 output k and Q 1,..., Q k c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 46 / 1

41 Scheduling All Intervals I1 I2 I3 I4 I5 I6 I7 I8 After Sorting Q1 Q2 Q3 c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 47 / 1

42 Scheduling All Intervals Proof of correctness: We only put intervals into available queues. So each queue contains only non-overlapping intervals. We need to show the algorithm uses minimum number of queues. (Namely, partition intervals into minimum number of subsets.) If the input contains k mutually overlapping intervals, we must use at least k queues. (Because no two such intervals can be placed into the same queue.) When the algorithm opens a new empty queue Q k for an interval [b p, f p ), none of the current queues Q 1,, Q k 1 is available. This means that the last intervals in Q 1,, Q k 1 all overlap with [b p, f p ). Hence the input contains k mutually overlapping intervals. The algorithm uses k queues. By the observation above, this is the smallest possible. c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 48 / 1

43 Scheduling All Intervals Runtime Analysis: Sorting takes O(n log n) time. The loop runs n times. The loop body scans Q 1,..., Q k to find the first available queue. So it takes O(k) time. Hence, the runtime is Θ(nk), (where k is the number of queues needed, or equivalently the chromatic number χ(g) of the input interval graph G.) In the worst case, k can be Θ(n). Hence, the worst case runtime is Θ(n 2 ). c Jinhui Xu (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 49 / 1

### Greedy Algorithms. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms

Greedy Algorithms A greedy algorithm is one where you take the step that seems the best at the time while executing the algorithm. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms Coin

### Single Source Shortest Path (SSSP) Problem

Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,

### 1 Non greedy algorithms (which we should have covered

1 Non greedy algorithms (which we should have covered earlier) 1.1 Floyd Warshall algorithm This algorithm solves the all-pairs shortest paths problem, which is a problem where we want to find the shortest

### Design and Analysis of Algorithms

CSE 101, Winter 018 D/Q Greed SP s DP LP, Flow B&B, Backtrack Metaheuristics P, NP Design and Analysis of Algorithms Lecture 8: Greed Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ Optimization

### Greedy Algorithms and Matroids. Andreas Klappenecker

Greedy Algorithms and Matroids Andreas Klappenecker Greedy Algorithms A greedy algorithm solves an optimization problem by working in several phases. In each phase, a decision is made that is locally optimal

### Advanced 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

### Greedy Algorithms and Matroids. Andreas Klappenecker

Greedy Algorithms and Matroids Andreas Klappenecker Giving Change Coin Changing Suppose we have n types of coins with values v[1] > v[2] > > v[n] > 0 Given an amount C, a positive integer, the following

### CSC 373: Algorithm Design and Analysis Lecture 4

CSC 373: Algorithm Design and Analysis Lecture 4 Allan Borodin January 14, 2013 1 / 16 Lecture 4: Outline (for this lecture and next lecture) Some concluding comments on optimality of EST Greedy Interval

### Minimum Spanning Trees

CS124 Lecture 5 Spring 2011 Minimum Spanning Trees A tree is an undirected graph which is connected and acyclic. It is easy to show that if graph G(V,E) that satisfies any two of the following properties

### 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

### Problem Set 2 Solutions

Problem Set 2 Solutions Graph Theory 2016 EPFL Frank de Zeeuw & Claudiu Valculescu 1. Prove that the following statements about a graph G are equivalent. - G is a tree; - G is minimally connected (it is

### 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

### CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science

CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science Entrance Examination, 5 May 23 This question paper has 4 printed sides. Part A has questions of 3 marks each. Part B has 7 questions

### 2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016

CS125 Lecture 2 Fall 2016 2.1 Greedy Algorithms We will start talking about methods high-level plans for constructing algorithms. One of the simplest is just to have your algorithm be greedy. Being greedy,

### 2. CONNECTIVITY Connectivity

2. CONNECTIVITY 70 2. Connectivity 2.1. Connectivity. Definition 2.1.1. (1) A path in a graph G = (V, E) is a sequence of vertices v 0, v 1, v 2,..., v n such that {v i 1, v i } is an edge of G for i =

### Week 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

### 4.1 Interval Scheduling

41 Interval Scheduling Interval Scheduling Interval scheduling Job j starts at s j and finishes at f j Two jobs compatible if they don't overlap Goal: find maximum subset of mutually compatible jobs a

### TU/e Algorithms (2IL15) Lecture 2. Algorithms (2IL15) Lecture 2 THE GREEDY METHOD

Algorithms (2IL15) Lecture 2 THE GREEDY METHOD x y v w 1 Optimization problems for each instance there are (possibly) multiple valid solutions goal is to find an optimal solution minimization problem:

### 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

### Dijkstra 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

### Math 454 Final Exam, Fall 2005

c IIT Dept. Applied Mathematics, December 12, 2005 1 PRINT Last name: Signature: First name: Student ID: Math 454 Final Exam, Fall 2005 I. Examples, Counterexamples and short answer. (6 2 ea.) Do not give

### 1 Variations of the Traveling Salesman Problem

Stanford University CS26: Optimization Handout 3 Luca Trevisan January, 20 Lecture 3 In which we prove the equivalence of three versions of the Traveling Salesman Problem, we provide a 2-approximate algorithm,

### Undirected 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

### February 24, :52 World Scientific Book - 9in x 6in soltys alg. Chapter 3. Greedy Algorithms

Chapter 3 Greedy Algorithms Greedy algorithms are algorithms prone to instant gratification. Without looking too far ahead, at each step they make a locally optimum choice, with the hope that it will lead

### Solution for Homework set 3

TTIC 300 and CMSC 37000 Algorithms Winter 07 Solution for Homework set 3 Question (0 points) We are given a directed graph G = (V, E), with two special vertices s and t, and non-negative integral capacities

### Artificial Intelligence

Artificial Intelligence Graph theory G. Guérard Department of Nouvelles Energies Ecole Supérieur d Ingénieurs Léonard de Vinci Lecture 1 GG A.I. 1/37 Outline 1 Graph theory Undirected and directed graphs

### Greedy Algorithms. Informal Definition A greedy algorithm makes its next step based only on the current state and simple calculations on the input.

Greedy Algorithms Informal Definition A greedy algorithm makes its next step based only on the current state and simple calculations on the input. easy to design not always correct challenge is to identify

### Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15

600.363 Introduction to Algorithms / 600.463 Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15 14.1 Introduction Today we re going to talk about algorithms for computing shortest

### Graph Coloring. Margaret M. Fleck. 3 May This lecture discusses the graph coloring problem (section 9.8 of Rosen).

Graph Coloring Margaret M. Fleck 3 May 2010 This lecture discusses the graph coloring problem (section 9.8 of Rosen). 1 Announcements Makeup quiz last day of classes (at the start of class). Your room

### 2 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

### 15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 While we have good algorithms for many optimization problems, the previous lecture showed that many

### CSC 1700 Analysis of Algorithms: Minimum Spanning Tree

CSC 1700 Analysis of Algorithms: Minimum Spanning Tree Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity overhead Dynamic programming

### Name: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G.

1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G. A shortest s-t path is a path from vertex to vertex, whose sum of edge weights is minimized. (b) Give the pseudocode

### Polynomial-Time Approximation Algorithms

6.854 Advanced Algorithms Lecture 20: 10/27/2006 Lecturer: David Karger Scribes: Matt Doherty, John Nham, Sergiy Sidenko, David Schultz Polynomial-Time Approximation Algorithms NP-hard problems are a vast

### Problem Set 2 Solutions

Design and Analysis of Algorithms February, 01 Massachusetts Institute of Technology 6.046J/18.410J Profs. Dana Moshkovitz and Bruce Tidor Handout 8 Problem Set Solutions This problem set is due at 9:00pm

### Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 5311 Lecture 16 Greedy algorithms Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Overview A greedy

### Greedy 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

### 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

### 5 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

### CSE 331: Introduction to Algorithm Analysis and Design Graphs

CSE 331: Introduction to Algorithm Analysis and Design Graphs 1 Graph Definitions Graph: A graph consists of a set of verticies V and a set of edges E such that: G = (V, E) V = {v 0, v 1,..., v n 1 } E

### Announcements Problem Set 5 is out (today)!

CSC263 Week 10 Announcements Problem Set is out (today)! Due Tuesday (Dec 1) Minimum Spanning Trees The Graph of interest today A connected undirected weighted graph G = (V, E) with weights w(e) for each

### Basic Graph Theory with Applications to Economics

Basic Graph Theory with Applications to Economics Debasis Mishra February, 0 What is a Graph? Let N = {,..., n} be a finite set. Let E be a collection of ordered or unordered pairs of distinct elements

### Approximation 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

### Lecture 8: The Traveling Salesman Problem

Lecture 8: The Traveling Salesman Problem Let G = (V, E) be an undirected graph. A Hamiltonian cycle of G is a cycle that visits every vertex v V exactly once. Instead of Hamiltonian cycle, we sometimes

### 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

### Greedy Algorithms. CLRS Chapters Introduction to greedy algorithms. Design of data-compression (Huffman) codes

Greedy Algorithms CLRS Chapters 16.1 16.3 Introduction to greedy algorithms Activity-selection problem Design of data-compression (Huffman) codes (Minimum spanning tree problem) (Shortest-path problem)

### 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

### 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.

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

### 5 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

### G205 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

### 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

### n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn)

CSE 0 Name Test Fall 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to find the maximum of the n elements of an integer array is in: A.

### Basic Graph Theory with Applications to Economics

Basic Graph Theory with Applications to Economics Debasis Mishra February 6, What is a Graph? Let N = {,..., n} be a finite set. Let E be a collection of ordered or unordered pairs of distinct elements

### 1 The Traveling Salesperson Problem (TSP)

CS 598CSC: Approximation Algorithms Lecture date: January 23, 2009 Instructor: Chandra Chekuri Scribe: Sungjin Im In the previous lecture, we had a quick overview of several basic aspects of approximation

### Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. V = {

### CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

1 Review 1 Something I did not emphasize enough last time is that during the execution of depth-firstsearch, we construct depth-first-search trees. One graph may have multiple depth-firstsearch trees,

### 11. APPROXIMATION ALGORITHMS

Coping with NP-completeness 11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: weighted vertex cover LP rounding: weighted vertex cover generalized load balancing knapsack problem

### CSC 373: Algorithm Design and Analysis Lecture 3

CSC 373: Algorithm Design and Analysis Lecture 3 Allan Borodin January 11, 2013 1 / 13 Lecture 3: Outline Write bigger and get better markers A little more on charging arguments Continue examples of greedy

### 1 i n (p i + r n i ) (Note that by allowing i to be n, we handle the case where the rod is not cut at all.)

Dynamic programming is a problem solving method that is applicable to many different types of problems. I think it is best learned by example, so we will mostly do examples today. 1 Rod cutting Suppose

### Analysis of Algorithms, I

Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, March 8, 2016 Outline 1 Recap Single-source shortest paths in graphs with real edge weights:

### Small Survey on Perfect Graphs

Small Survey on Perfect Graphs Michele Alberti ENS Lyon December 8, 2010 Abstract This is a small survey on the exciting world of Perfect Graphs. We will see when a graph is perfect and which are families

### 1 Definition of Reduction

1 Definition of Reduction Problem A is reducible, or more technically Turing reducible, to problem B, denoted A B if there a main program M to solve problem A that lacks only a procedure to solve problem

### 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.

### 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

### Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Michiel Smid October 14, 2003 1 Introduction In these notes, we introduce a powerful technique for solving geometric problems.

### List of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,

List of Theorems Mat 416, Introduction to Graph Theory 1. Ramsey s Theorem for graphs 8.3.11. Theorem 1 The numbers R(p, q) exist and for p, q 2, R(p, q) R(p 1, q) + R(p, q 1). If both summands on the

### Copyright 2000, Kevin Wayne 1

Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. Directed

### 18 Spanning Tree Algorithms

November 14, 2017 18 Spanning Tree Algorithms William T. Trotter trotter@math.gatech.edu A Networking Problem Problem The vertices represent 8 regional data centers which need to be connected with high-speed

### CS 2336 Discrete Mathematics

CS 2336 Discrete Mathematics Lecture 15 Graphs: Planar Graphs 1 Outline What is a Planar Graph? Euler Planar Formula Platonic Solids Five Color Theorem Kuratowski s Theorem 2 What is a Planar Graph? Definition

### Approximation Algorithms: The Primal-Dual Method. My T. Thai

Approximation Algorithms: The Primal-Dual Method My T. Thai 1 Overview of the Primal-Dual Method Consider the following primal program, called P: min st n c j x j j=1 n a ij x j b i j=1 x j 0 Then the

### CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory Allan Borodin September 27, 2012 1 / 23 Lecture 3 1 We will first do the analysis of the Greedy α revocable priority algorithm for the WISP problem

### Lecture 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

### Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

Today. Types of graphs. Complete Graphs. Trees. Hypercubes. Complete Graph. K n complete graph on n vertices. All edges are present. Everyone is my neighbor. Each vertex is adjacent to every other vertex.

### MITOCW watch?v=tkwnms5irbu

MITOCW watch?v=tkwnms5irbu The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

### Introduction: (Edge-)Weighted Graph

Introduction: (Edge-)Weighted Graph c 8 7 a b 7 i d 9 e 8 h 6 f 0 g These are computers and costs of direct connections. What is a cheapest way to network them? / 8 (Edge-)Weighted Graph Many useful graphs

### 22c:31 Algorithms. Kruskal s Algorithm for MST Union-Find for Disjoint Sets

22c:1 Algorithms Kruskal s Algorithm for MST Union-Find for Disjoint Sets 1 Kruskal s Algorithm for MST Work with edges, rather than nodes Two steps: Sort edges by increasing edge weight Select the first

### Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

COMPSCI 632: Approximation Algorithms August 30, 2017 Lecturer: Debmalya Panigrahi Lecture 2 Scribe: Nat Kell 1 Introduction In this lecture, we examine a variety of problems for which we give greedy approximation

### Lecturers: Sanjam Garg and Prasad Raghavendra March 20, Midterm 2 Solutions

U.C. Berkeley CS70 : Algorithms Midterm 2 Solutions Lecturers: Sanjam Garg and Prasad aghavra March 20, 207 Midterm 2 Solutions. (0 points) True/False Clearly put your answers in the answer box in front

### Introduction 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

### Steiner 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

### Maximal Independent Set

Chapter 0 Maximal Independent Set In this chapter we present a highlight of this course, a fast maximal independent set (MIS) algorithm. The algorithm is the first randomized algorithm that we study in

### Chapter 12 and 11.1 Planar graphs, regular polyhedra, and graph colorings

Chapter 12 and 11.1 Planar graphs, regular polyhedra, and graph colorings Prof. Tesler Math 184A Fall 2017 Prof. Tesler Ch. 12: Planar Graphs Math 184A / Fall 2017 1 / 45 12.1 12.2. Planar graphs Definition

### Elementary maths for GMT. Algorithm analysis Part II

Elementary maths for GMT Algorithm analysis Part II Algorithms, Big-Oh and Big-Omega An algorithm has a O( ) and Ω( ) running time By default, we mean the worst case running time A worst case O running

### Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Graphs and Trees Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) who is connected to whom Web search views web pages as a graph Who points to whom Niche graphs (Ecology):

### 1. The following graph is not Eulerian. Make it into an Eulerian graph by adding as few edges as possible.

1. The following graph is not Eulerian. Make it into an Eulerian graph by adding as few edges as possible. A graph is Eulerian if it has an Eulerian circuit, which occurs if the graph is connected and

### 1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time: Input: A CNF formula ϕ with n variables x 1, x 2,..., x n. Output: True if there is an

### 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

### Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

CS261, Winter 2017. Instructor: Ashish Goel. Problem set 2 Electronic submission to Gradescope due 11:59pm Thursday 2/16. Form a group of 2-3 students that is, submit one homework with all of your names.

### 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

### Algorithms 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

### CHAPTER 13 GRAPH ALGORITHMS

CHAPTER 13 GRAPH ALGORITHMS SFO LAX ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 00) AND SLIDES FROM NANCY

### Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn Graphs Extremely important concept in computer science Graph, : node (or vertex) set : edge set Simple graph: no self loops, no multiple

### Scheduling, Map Coloring, and Graph Coloring

Scheduling, Map Coloring, and Graph Coloring Scheduling via Graph Coloring: Final Exam Example Suppose want to schedule some ;inal exams for CS courses with following course numbers: 1007, 3137, 3157,

### These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

Undirected Graphical Models: Chordal Graphs, Decomposable Graphs, Junction Trees, and Factorizations Peter Bartlett. October 2003. These notes present some properties of chordal graphs, a set of undirected

### UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 16 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 16 Notes Goals for this week Graph basics Types

### 1 Linear programming relaxation

Cornell University, Fall 2010 CS 6820: Algorithms Lecture notes: Primal-dual min-cost bipartite matching August 27 30 1 Linear programming relaxation Recall that in the bipartite minimum-cost perfect matching

### / Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang

600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang 9.1 Linear Programming Suppose we are trying to approximate a minimization