COSCMATH 4 P 61 Theory of Computation Minimumweight

  • Slides: 7
Download presentation
COSC/MATH 4 P 61 - Theory of Computation Minimum-weight Spanning Tree 12 12 1

COSC/MATH 4 P 61 - Theory of Computation Minimum-weight Spanning Tree 12 12 1 15 2 10 3 1 18 Weighted Graph © M. Winter 2 10 20 4 15 3 20 18 4 Spanning Tree with weight: 10+18+20=48 11. 1

COSC/MATH 4 P 61 - Theory of Computation Minimum-weight Spanning Tree 12 12 1

COSC/MATH 4 P 61 - Theory of Computation Minimum-weight Spanning Tree 12 12 1 15 2 10 3 1 18 Weighted Graph © M. Winter 2 10 20 4 15 3 20 18 4 Spanning Tree with minimum weight: 12+10+18=40 11. 2

COSC/MATH 4 P 61 - Theory of Computation Kruskal’s Algorithm 1. Maintain for each

COSC/MATH 4 P 61 - Theory of Computation Kruskal’s Algorithm 1. Maintain for each node the connected component in which the node appears, using the edge selected so far. Initially every node is in a component by itself. 2. Consider the edge with the lowest weight that has not been considered yet. a) If this edge connects two node from currently different components, then add the edge to the result and merge the two components. b) If this edge connects two node from the same component, then do not add the edge to the result. 3. Continue until all edges have been considered. Complexity: O(e(e + m)) where m is the number of nodes and e is the number of edges. © M. Winter 11. 3

COSC/MATH 4 P 61 - Theory of Computation Kruskal’s Algorithm 12 12 1 2

COSC/MATH 4 P 61 - Theory of Computation Kruskal’s Algorithm 12 12 1 2 15 10 3 12 1 10 20 4 18 3 12 1 2 10 20 4 18 15 3 20 18 4 12 1 15 2 10 3 © M. Winter 2 15 1 18 2 10 20 4 15 3 20 18 4 11. 4

COSC/MATH 4 P 61 - Theory of Computation Travelling Salesman Problem (TSP) 12 1

COSC/MATH 4 P 61 - Theory of Computation Travelling Salesman Problem (TSP) 12 1 15 2 10 3 20 18 4 Hamilton (only one): (1, 2, 4, 3, 1) Find all cycles and choose the one with minimum weight. Complexity: O(m!) © M. Winter 11. 5

COSC/MATH 4 P 61 - Theory of Computation NP Complete Problems • • SAT

COSC/MATH 4 P 61 - Theory of Computation NP Complete Problems • • SAT CSAT 3 SAT Independent Set Problem (IS) Node-Cover Problem (NC) Directed Hamilton-Circuit Problem (DHC) Undirected Hamilton-Circuit Problem (HC) TSP © M. Winter 11. 6

COSC/MATH 4 P 61 - Theory of Computation Reductions © M. Winter 11. 7

COSC/MATH 4 P 61 - Theory of Computation Reductions © M. Winter 11. 7