Download presentation

Presentation is loading. Please wait.

Published byRahul Hamel Modified over 2 years ago

1
Chen, Lu Mentor: Zhou, Jian Shanghai University, School of Management Email: Chen213.shu.edu.cn

2
The object is to minimize the total length of the links inserted into the network. Conditions: Every pair of vertices is connected by exactly one path. n-1 links need to be chosen. No cycle. 2

3
Ⅰ Kruskal Algorithm (1956)Kruskal Algorithm (1956) Ⅱ Prim Algorithm (1957)Prim Algorithm (1957) Ⅲ Dijkstra Algorithm (1959)Dijkstra Algorithm (1959) Ⅳ Reverse Delete AlgorithmReverse Delete Algorithm Ⅴ Sollin Algorithm (1961)Sollin Algorithm (1961) 3

4
G=( V, E ) w v means vertex. e means edges. w means weight. 4

5
1. Sort the edges by weight. 2. Examine each edge in the order of increasing weight. 3. If the edge examined does not create a cycle with the edges in the current forest, it is added to the forest; otherwise, it is discard. 5

6
w 12 w 45 w 14 w 25 w 35 w 23 w 13 w 43 √ √ √ × √ × × × 4 1 2 3 5 1 76 8 5 3 2 4 6

7
4 1 2 3 5 1 5 3 2 7

8
1. Select any node arbitrarily, and then connect it to the nearest distinct node. 2. Identify the unconnected node that is closest to a connected node, and then connect these two nodes. 3. Repeat step 2 until all nodes have been connected. 8

9
4 1 2 3 5 1 76 8 5 3 2 4 9

10
Ties for the nearest distinct node or the closest unconnected node may be broken arbitrarily, and the algorithm must still yield an optimal solution. 10

11
4 1 2 3 5 1 76 8 5 4 2 4 11

12
4 1 2 3 5 1 5 2 12 4

13
4 1 2 3 5 1 5 2 4 13

14
Special Prim algorithm Definitions: S ： Set of the nodes which have been connected by branch. S’ ： The remaining nodes. d(v) ： Distance from note v to S. 14

15
Step1: Set N={1, 2,…,n}, and d j =w 1 j. Step2: d j* =min{d j | j∈S’}=w i j* (i∈S, j*∈S’), j* add into S. Step3: d j = min{ d j ， w j*j }, j∈S, return to step 2, until S=N. 15

16
4 1 2 3 5 1 76 8 5 3 2 4 16

17
1. Select vertex1 as the starting point, S={1}. 2. d 2 =w 12 = 1, d 3 =7, d 4 =3 d j *=min{d 2, d 3, d 4 | j∈S’} =w 12 =w ij* = 1 j*=2,vertex 2 add into S, and S={1,2}. 3. d 4 =min{d 4, w 24 }=min{3, 4}=3 d 3 =min{d 3, w 23 }=min{7, 6}=6 d 5 =min{d 5, w 25 }=min{5, 4}=4 d j *=min{d 4, d 3, d 5 | j∈S’} =w 14 =w ij* =3 j*=4, vertex 4 add into S, and S={1,2,4} 17

18
4 1 2 3 5 18 3 （ d 4 =w 14 ） 1 (d 2 =w 12 )

19
4. d 3 =min{d 3, w 43 }=min{7, 8}=7 d 5 =min{d 5, w 45 }=min{5, 2}=2 d j *=min{d 4, d 3, d 5 | j∈S’} =w 45 =w ij* =32 j*=5, vertex 5 add into S, and S={1,2,4,5} 5. d 3 =min{d 3, w 53 }=min{7, 5}=5 j*=3, vertex 3 add into S. 6. S={1,2,4,5,3}=N. 19

20
4 1 2 3 5 5(w 53 ) 2(w 45 ) 20 3 （ d 4 =w 14 ） 1 (d 2 =w 12 )

21
It is the reverse of Kruskal’s algorithm Also called “Tear Cycle Method” 21

22
1. Select a spanning tree arbitrarily 2. Add a branch in this tree, then there will be a loop in the graph. Removal the longest one. 3. Repeat step 2 until all the edges have been tested 22

23
4 1 2 3 5 1 76 8 5 3 2 4 23

24
4 1 2 3 5 1 76 8 5 3 2 4 24

25
4 1 2 3 5 1 76 8 5 3 2 4 25

26
4 1 2 3 5 1 76 8 5 3 2 4 26

27
4 1 2 3 5 1 76 8 5 3 2 4 27

28
4 1 2 3 5 1 76 8 5 3 2 4 28

29
Original: Borůvka‘s algorithm （ 1926 ） Reason: Because Sollin was the only computer scientist in this list living in an English speaking country, this algorithm is frequently called Sollin's algorithm. 29

30
1. Every vertex signify a tree ， and the original graph signify a forest. 2. Chose every vertex’s closet edge. If some vertexes’ closet edge are the same edge, these vertexes merge into a new vertex. 3. Repeat step 2 ， until there is only one tree in the forest. 30

31
4 1 2 3 5 1 76 8 5 3 2 4 1e 12 2e 12 3e 35 4e 45 5 e 45 31

32
4 1 2 3 5 1 76 85 3 2 4 1,2 e 14 4,5 e 14 3 e 35 32

33
4 1 2 3 5 1 76 85 3 2 4 1,2,4,5 e35 3 e35 33

34
4 1 2 3 5 1 76 8 5 3 2 4 34

35
35

Similar presentations

OK

Spanning Trees CSIT 402 Data Structures II 1. 2 Two Algorithms Prim: (build tree incrementally) – Pick lower cost edge connected to known (incomplete)

Spanning Trees CSIT 402 Data Structures II 1. 2 Two Algorithms Prim: (build tree incrementally) – Pick lower cost edge connected to known (incomplete)

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on number system in maths Ppt on power line communication circuit Ppt on conference call etiquette Ppt on basics of ms office Perspective view ppt on iphone Ppt on global warming in hindi Download ppt on square and square roots for class 8 Ppt on narendra modi Ppt on 60 years of indian parliament latest Ppt on non agricultural activities in uganda