Presentation is loading. Please wait.

Presentation is loading. Please wait.

Minimum spanning tree Prof Amir Geva Eitan Netzer.

Similar presentations


Presentation on theme: "Minimum spanning tree Prof Amir Geva Eitan Netzer."— Presentation transcript:

1 Minimum spanning tree Prof Amir Geva Eitan Netzer

2 Definition A sub group of edges from weighted graph G Spanning – reach all vertex Minimal – the sum of its edges is the lowest of all spanning trees Uses – connect a network with while spending minimum money Graph need to be connective

3

4 Prim algorithm (1957) Greedy algorithm Start with an empty list of vertex. Choose starting vertex from G. Randomly or a given choice. Add edge with minimal weight that not used yet to an un explored vertex. Continue until list of vertex contain all vertex in G. Minimum edge weight data structureTime complexity (total) adjacency matrixadjacency matrix, searchingO(|V| 2 ) binary heapbinary heap and adjacency listadjacency listO((|V| + |E|) log |V|) = O(|E| log |V|) Fibonacci heapFibonacci heap and adjacency listadjacency listO(|E| + |V| log |V|)

5 Pseudo Code

6

7

8

9

10

11

12

13

14

15

16 Kruskal's algorithm (1956) Greedy algorithm Create a “forest” F a set of trees Create a set S containing all edges of G While S is not empty and F is not a spanning tree yet Remove minimum edge from S If edge connects to trees in F combine them Else discard edge

17 Pseudo Code

18

19

20

21

22

23

24


Download ppt "Minimum spanning tree Prof Amir Geva Eitan Netzer."

Similar presentations


Ads by Google