Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.

Slides:



Advertisements
Similar presentations
Decision Maths Networks Kruskals Algorithm Wiltshire Networks A Network is a weighted graph, which just means there is a number associated with each.
Advertisements

Great Theoretical Ideas in Computer Science
Graph Theory Arnold Mesa. Basic Concepts n A graph G = (V,E) is defined by a set of vertices and edges v3 v1 v2Vertex (v1) Edge (e1) A Graph with 3 vertices.
Great Theoretical Ideas in Computer Science for Some.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Minimum Spanning Trees
9.2 The Traveling Salesman Problem. Let us return to the question of finding a cheapest possible cycle through all the given towns: We have n towns (points)
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
1 Spanning Trees Lecture 20 CS2110 – Spring
Discussion #36 Spanning Trees
7.3 Kruskal’s Algorithm. Kruskal’s Algorithm was developed by JOSEPH KRUSKAL.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Approximation Algorithms: Combinatorial Approaches Lecture 13: March 2.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Spanning Trees.
Spanning Trees. 2 Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges.
Great Theoretical Ideas in Computer Science.
Minimal Spanning Trees. Spanning Tree Assume you have an undirected graph G = (V,E) Spanning tree of graph G is tree T = (V,E T E, R) –Tree has same set.
3/29/05Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta.
Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Data Structures and Algorithms Graphs Minimum Spanning Tree PLSD210.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Copyright © Cengage Learning. All rights reserved.
 Jim has six children.  Chris fights with Bob,Faye, and Eve all the time; Eve fights (besides with Chris) with Al and Di all the time; and Al and Bob.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
7 Graph 7.1 Even and Odd Degrees.
10.4 How to Find a Perfect Matching We have a condition for the existence of a perfect matching in a graph that is necessary and sufficient. Does this.
COSC 2007 Data Structures II Chapter 14 Graphs III.
Dijkstra’s Algorithm. Announcements Assignment #2 Due Tonight Exams Graded Assignment #3 Posted.
Prims’ spanning tree algorithm Given: connected graph (V, E) (sets of vertices and edges) V1= {an arbitrary node of V}; E1= {}; //inv: (V1, E1) is a tree,
Minimum Spanning Trees Prof. Sin-Min Lee Dept. of Computer Science, San Jose State University.
Mathematical Proofs And how they are applied to Computer Olympiads.
EMIS 8374 Optimal Trees updated 25 April slide 1 Minimum Spanning Tree (MST) Input –A (simple) graph G = (V,E) –Edge cost c ij for each edge e 
Prim's Algorithm This algorithm starts with one node. It then, one by one, adds a node that is unconnected to the new graph to the new graph, each time.
Lectures on Greedy Algorithms and Dynamic Programming
Introduction to Graph Theory
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 7 The Mathematics of Networks 7.1Trees 7.2Spanning Trees 7.3 Kruskal’s.
Chapter 8 Maximum Flows: Additional Topics All-Pairs Minimum Value Cut Problem  Given an undirected network G, find minimum value cut for all.
SPANNING TREES Lecture 21 CS2110 – Fall Nate Foster is out of town. NO 3-4pm office hours today!
Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.
Minimum- Spanning Trees
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 11.
D1 Discrete Mathematics
Great Theoretical Ideas in Computer Science
Minimal Spanning Trees
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Discrete Mathematics for Computer Science
Minimum-Cost Spanning Tree
Minimum Spanning Tree.
The Travelling Salesperson problem
D1 Discrete Mathematics
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Spanning Trees.
4-4 Graph Theory Trees.
Applied Combinatorics, 4th Ed. Alan Tucker
Networks Kruskal’s Algorithm
Richard Anderson Lecture 10 Minimum Spanning Trees
Minimum Spanning Tree.
5.4 T-joins and Postman Problems
EE5900 Advanced Embedded System For Smart Infrastructure
Minimum spanning trees
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Prims’ spanning tree algorithm
Minimum-Cost Spanning Tree
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

Chapter 9 Finding the Optimum 9.1 Finding the Best Tree

A country with n towns wants to construct a new telephone network to connect all towns. Of course, they don't have to build a separate line between every pair of towns. (there may be good reasons for doing so, as we shall see later) In our terms, this means that the graph of direct connections must form a connected graph. Let‘s assume that they don’t want to build a direct line between towns that can be reached otherwise. Thus they want to build a minimal connected graph with these nodes, i.e., a tree.

We know that no matter which tree they choose to build, they have to construct (n – 1) lines. Does this mean that it does not matter which tree they build? No, because lines are not equally easy to build. Some lines between towns may cost much more than some other lines, depending on how far the towns are, whether there are mountains or lakes between them,etc. So the task is to find a spanning tree whose total cost (the sum of costs of its edges) is minimal.

At this point, the task seems trivial (very easy) again: Just compute the cost of each tree on these nodes, and select the tree with smallest cost.

Let's see how the optimistic government would build the telephone network. They start with raising money; as soon as they have enough money to build a line (the cheapest line). Then they wait until they have enough money to build a second connection. Then they wait until they have enough money to build a third connection... It may happen that the third-cheapest connection forms a triangle with the first two. Then, of course, they skip this and raise enough money to build the fourth-cheapest connection.

Our optimistic government would do the following: Build the cheapest line, then the second cheapest, then the third cheapest, etc., skipping the construction of lines that are superfluous: It will not build a third edge out of a town that already has two, and will not build an edge completing a cycle unless this cycle connects all nodes. Eventually, they get a cycle through all towns, but this is not necessarily the best!

Figure 9.1. Failure of the greedy method. Construction costs are proportional to the distance. The first figure shows a cheapest (shortest) cycle through all 4 towns; the second shows the cycle obtained by the optimistic (greedy) method.

So let us return to the solution of the problem of finding a tree with minimum cost, and prove that the optimistic method yields a cheapest tree. The optimistic method is often called the greedy Algorithm; in the context of spanning trees, it is called Kruskal's Algorithm. Let us call the tree obtained by the greedy method the greedy tree, and denote it by F. In other words, we want to prove that any other tree would cost at least as much as the greedy.

So let G be any tree different from the greedy tree F. Let us imagine the process of constructing F, and the step when we first pick an edge that is not an edge of G. Let e be this edge. If we add e to G, we get a cycle C. This cycle is not fully contained in F, so it has an edge f that is not an edge of F (Figure 9.2). If we add the edge e to G and then delete f, we get a (third) tree H.

We want to show that H is at most as expensive as G. This clearly means that e is at most as expensive as f. Suppose that f is cheaper than e.

Now comes a crucial question: Why didn't the optimistic government select f instead of e at this point in time? The only reason could be thatf was ruled out because it would have formed a cycle G' with the edges of F already selected. But all these previously selected edges are edges of G,since we are inspecting the step when the first edge not in G was added to F. Since f itself is an edge of G, it follows that all edges of G' are edges of G, which is impossible, since G is a tree. This contradiction proves that f cannot be cheaper than e and hence G cannot be cheaper than H.

So we replace G by this tree H that is not more expensive. In addition,the new tree H has the advantage that it coincides with F in more edges,since we deleted from G an edge not in F and added an edge in F. This implies that if H is different from F and we repeat the same argument again and again, we get trees that are not more expensive than G, and coincide with F in more and more edges. Sooner of later we must end up with F itself, proving that F was no more expensive than G.