0% found this document useful (0 votes)
21 views

Graphs Practice

The document contains practice exercises for graph algorithms, specifically Prim's, Kruskal's, and Dijkstra's algorithms. It includes multiple instances of graphs where students are tasked with drawing the Minimum Spanning Tree (MST) or Shortest Path Tree (SPT) based on the specified algorithm. Each section provides a graph with labeled vertices and edges for students to analyze and solve.

Uploaded by

phat07102003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Graphs Practice

The document contains practice exercises for graph algorithms, specifically Prim's, Kruskal's, and Dijkstra's algorithms. It includes multiple instances of graphs where students are tasked with drawing the Minimum Spanning Tree (MST) or Shortest Path Tree (SPT) based on the specified algorithm. Each section provides a graph with labeled vertices and edges for students to analyze and solve.

Uploaded by

phat07102003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

COSC 2436: Graphs Practice

J. Eoin Donovan - 2024


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

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

You might also like