5. Select the next
shortest
edge which does not
create a cycle
ED 2
AB 3A
F
B
C
D
E
2
7
4
5
8 6
4
5
3
8
Kruskal’s Algorithm
6. Select the next
shortest
edge which does not
create a cycle
ED 2
AB 3
CD 4 (or AE 4)
A
F
B
C
D
E
2
7
4
5
8 6
4
5
3
8
Kruskal’s Algorithm
7. Select the next
shortest edge which
does not create a cycle
ED 2
AB 3
CD 4
AE 4
A
F
B
C
D
E
2
7
4
5
8 6
4
5
3
8
Kruskal’s Algorithm
8. Select the next shortest
edge which does not
create a cycle
ED 2
AB 3
CD 4
AE 4
BC 5 – forms a cycle
EF 5
A
F
B
C
D
E
2
7
4
5
8 6
4
5
3
8
Kruskal’s Algorithm
9. All vertices have been
connected.
The solution is
ED 2
AB 3
CD 4
AE 4
EF 5
Total weight of tree:
18
A
F
B
C
D
E
2
7
4
5
8 6
4
5
3
8
Kruskal’s Algorithm
16. Hamilton path
In the mathematical field of graph theory, a Hamiltonian path (or traceable
path) is a path in an undirected or directed graph that visits each vertex
exactly once.
Traceable graph
17. Hamilton path & cycle
A Hamiltonian cycle is a cycle that visits each vertex exactly once
(except for the vertex that is both the start and end, which is visited
twice).
18. Dijkstra's algorithm
Dijkstra's algorithm - is a solution to the single-source
shortest path problem in graph theory.
Works on both directed and undirected graphs. However,
all edges must have nonnegative weights.
Approach: Greedy
Input: Weighted graph G={E,V} and source vertex v∈V,
such that all edge weights are nonnegative
Output: Lengths of shortest paths (or the shortest paths
themselves) from a given source vertex v∈V to all other
vertices
18