LAB 5: Graph: 1 Excercises
LAB 5: Graph: 1 Excercises
LAB 5: Graph: 1 Excercises
LAB 5: Graph
1 Excercises
1. The ”graph1.txt” file contains information of an Adjacency matrix (Table 1). Read the file and
output the information of the corresponding Adjacency list.
2. The ”graph2.txt” file contains information of an Adjacency list (Table 1). Read the file and
output the information of the corresponding Adjacency matrix.
Adjacency matrix Adjacency list
9
9
0 0 1 0 0 1 0 0 0
25
0 0 0 0 0 0 1 0 0
6
0 0 0 0 0 0 1 0 0
6
0 0 0 0 1 0 0 0 0
4
0 0 0 0 0 1 0 0 0
5
0 0 0 1 0 0 0 1 0
37
0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 1
28
0 0 0 0 0 0 0 0 0
Page 1 / 2
Data Structures & Algorithms Knowledge Engineering Department
11. Find the shortest path between 2 vertices of a given graph using:
Page 2 / 2