Download presentation

Presentation is loading. Please wait.

Published byAdam Rees Modified over 2 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

4
Example: start with 7

5
Prims Algorithm Minimal Spanning Tree

6

7

8

9

10

11

12

13

14

15

16

17

18
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

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google