Graphs Practice
Graphs Practice
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
12 10 9 8
5
E F G H
10 5 6
Prim’s Algorithm Practice
Draw the MST for the graph below using Prim’s algorithm starting
from vertex A.
6 4 8
A B C D
5
5
E F G H
5 6
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
9 12 10 14
E F G H
10 5 12
Kruskal’s Algorithm Practice
Draw the MST for the graph below using Kruskal’s algorithm.
5 4 8
A B C D
E F G H
10 5 12
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm. Source = A
A
3 12
D E
3 2
7
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
3 2
7
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
3 2 ∞ ∞ 3 12
7
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
7 12
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
7 12
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
7 12
9
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3 12 A B C D E
0 ∞ ∞ ∞ ∞
D E
∞ ∞ 3 12
3 2
7 8 6 12
5
7 12
9
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm.
A
3
D E
3 2
B C
1
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm. Source = A
9
4
B D
3 2
2 7
A 3 2 F
5 5
C E
6
8
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm. Source = A
A B C D E F
0 ∞ ∞ ∞ ∞ ∞
3 5 9 ∞ ∞
5 7 5 ∞
7 5 13
7 10
9
Dijkstra’s Practice
Find the SPT of the graph below using Dijkstra’s algorithm. Source = A
4
B D
3 2
2
A F
5
C E