Download presentation

Presentation is loading. Please wait.

Published byAdam Rees Modified over 4 years ago

1
Spanning Trees

2
Prims MST Algorithm Algorithm ( this is also greedy) Select an arbitrary vertex to start the tree, while there are fringe vertices: 1)select an edge of minimum weight between a tree vertex and a fringe vertex. 2)add the selected edge and the fringe vertex to the tree. end.

3
Prims Algorithm Minimal Spanning Tree 1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 6 2 5 2 6

4
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 6 2 5 2 6 Example: start with 7

5
Prims Algorithm Minimal Spanning Tree 1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 6 2 5 2 6

6
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 6 2 5 2 6

7
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 6 2 5 2 6

8
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 2 5 2 6

9
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 2 5 2 6

10
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 2 5 6

11
1 6 24 35 3 2 1 4 4 2 5 3 4 78 1 2 5 6

12
1 6 24 35 2 1 4 4 2 5 3 4 78 1 2 6

13
1 6 24 35 2 1 4 4 2 5 3 4 78 1 2 6

14
1 6 24 35 2 1 4 2 5 3 4 78 1 2 6

15
1 6 24 35 2 1 4 2 5 3 4 78 1 2 6

16
1 6 24 35 2 1 2 5 3 4 78 1 2

17
1 6 24 35 2 1 2 5 3 4 78 1 2

18
1 6 24 35 2 1 2 3 78 1 2 MST weight = 15 4

19
Topological Sorting Algorithm while (the graph has a node with no successor) do remove one of those nodes from the graph and add it to the end of a list if (the graph is empty) then the list contains the reverse of some topological order else the graph contains a cycle

20
A B C D E F G HI J L K M

21
A B C D E F G HI J L K M D

22
A B C E F G HI J L K M D E

23
A B C F G HI J L K M DE F

24
A B C G HI J L K M DEF C

25
A B G HI J L K M DEFC B

26
A G H I J L K M DEFCB I

27
A G H J L K M DEFCBI H

28
A G J L K M DEFCBIH G

29
A J L K M DEFCBIHG A

30
J L K M DEFCBIHGA K

31
J L M DEFCBIHGAK M

32
J L DEFCBIHGAKM L

33
J DEFCBIHGAKML J

34
DEFCBIHGAKMLJ J L M K A G H I B C F E D

Similar presentations

OK

Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.

Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google