Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Minimum Cost Spanning Tree Problem

Similar presentations


Presentation on theme: "The Minimum Cost Spanning Tree Problem"— Presentation transcript:

1 The Minimum Cost Spanning Tree Problem
Lecture 8 The Minimum Cost Spanning Tree Problem Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

2

3

4

5

6

7

8

9

10 a

11

12

13

14

15

16

17

18

19 The Greedy Algorithm animation

20 The Greedy Algorithm in Action
35 10 30 15 25 40 20 17 8 11 21 1 2 3 4 5 6 7 2 4 6 1 3 5 7

21 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

22 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

23 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

24 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

25 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

26 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

27 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

28 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

29 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

30 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

31 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

32 The Greedy Algorithm in Action
10 10 8 8 2 4 4 6 2 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11

33 Correctness

34 Exchange Property

35 Self-Reducibility

36

37

38 Data Structures “Disjoint Sets”

39 Kruskal Algorithm with Data Structure

40 The Greedy Algorithm in Action
Node First 10 10 8 8 2 4 2 4 6 6 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11 root node 40

41 The Greedy Algorithm in Action
Node First 10 10 8 8 2 2 4 2 4 6 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 5 7 15 15 11 41

42 The Greedy Algorithm in Action
Node First 10 10 8 8 2 4 2 4 6 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 7 3 5 7 15 15 11 42

43 The Greedy Algorithm in Action
Node First 10 10 8 8 2 4 6 2 4 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 3 5 7 7 3 5 7 15 15 11 43

44 The Greedy Algorithm in Action
Node First 10 10 8 8 2 4 6 2 4 6 35 35 15 15 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 5 7 3 3 5 5 7 7 3 5 7 15 15 11 44

45 The Greedy Algorithm in Action
Node First 10 10 8 8 2 4 6 2 4 6 35 35 15 15 1 1 1 25 25 20 20 30 30 17 17 21 21 40 40 11 3 3 5 7 5 7 3 5 7 15 15 11 45

46

47 Prim’s algorithm animation

48

49 Correctness The cut-optimality Condition

50 Prim’s Algorithm in Action
10 8 2 2 4 4 6 6 35 15 1 1 25 20 30 17 21 40 11 3 5 7 3 5 7 15 The minimum cost arc from yellow nodes to green nodes can be found by placing arc values in a priority queue.

51 Prim’s Algorithm in Action
25 10 10 8 2 2 2 4 4 6 6 35 35 15 1 1 25 20 30 17 21 40 11 3 5 7 3 5 7 15

52 Prim’s Algorithm in Action
8 20 30 21 8 10 10 10 2 2 2 4 4 4 6 6 35 35 15 1 1 25 25 30 20 17 21 40 11 3 5 7 3 5 7 15

53 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 17 15 15 1 1 25 25 30 30 17 20 20 21 21 40 11 3 5 7 3 5 7 15

54 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 15 11 11 3 5 5 7 3 5 7 15

55 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 15 11 11 3 5 5 7 3 5 7 15

56 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 11 11 11 3 5 5 7 7 3 5 7 15 15

57 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 11 11 11 3 3 5 5 7 7 3 5 7 15 15 15

58 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 11 11 11 3 3 5 5 7 7 3 5 7 15 15 15

59 Prim’s Algorithm in Action
8 8 8 10 10 10 2 2 2 4 4 4 6 6 6 35 35 15 15 15 1 1 25 25 30 30 17 17 20 20 21 21 40 11 11 11 3 3 5 5 7 7 3 5 7 15 15 15

60

61 Sollin’s Algorithm animation

62

63 Correctness Cut-optimality Condition

64 Sollin’s Algorithm in Action
10 8 2 2 2 4 4 4 6 6 6 35 15 1 1 1 25 20 30 17 21 40 3 3 5 5 7 7 3 5 11 7 15 Treat all nodes as singleton components, and then select the min cost arc leaving the component.

65 Sollin’s Algorithm in Action
10 8 2 2 4 4 6 6 6 35 15 1 1 25 20 30 17 21 40 3 3 5 5 7 7 3 5 15 11 7 Find the min cost edge out of each component

66

67 Appendix: Priority Queue

68 Priority Queue A priority queue is a data structure for maintaining a set of elements, each with an associated value, called a key. A min-priority queue supports the following operations: Insert(S,x), Minimum(S), Extract-Min(S), Increase-Key(S,x,k). Min-Heap can be used for implementing min-priority queue.

69

70

71

72


Download ppt "The Minimum Cost Spanning Tree Problem"

Similar presentations


Ads by Google