Question: You will write a C program to process a graph using its adjacency matrix stored in a . txt file as the input ( a
You will write a C program to process a graph using its adjacency matrix stored in a txt file as
the input a sample file is provided The program should read the graph and provide several
functionalities for interacting with the graph.
Input:
The adjacency matrix denoted as A for the graph will be stored in a txt file, where rows and
columns represent vertices numbered and the values in the matrix represent the edge
weights. If aij it means that there is no edge between the vertex i and j
Requirements:
Commandline argument:
o The program should accept the filename of the txt file containing the graph's
adjacency matrix as a commandline argument.
o Example usage: a examplegraph.txt the executable is named a
Menu of Options: Upon running the program, it should present the user with a menu of
options. The user should be able to type the number of an option, and the program should
execute the corresponding functionality.
Display Adjacency List
Perform BreadthFirst Search BFS
Perform DepthFirst Search DFS
Find Shortest Path using Dijkstra's Algorithm
Exit
Option Details:
o Option : Display Adjacency List
When this option is selected, the program should print the adjacency list
representation of the graph. Each vertex should list its connected vertices along
with weights of the edges.
o Option : Perform BreadthFirst Search BFS
When this option is selected, the program should perform a BreadthFirst Search
BFS traversal starting from vertex The program should print the vertices in
the order they are visited.
o Option : Perform DepthFirst Search DFS
When this option is selected, the program should perform a DepthFirst Search
DFS traversal starting from vertex The program should print the vertices in
the order they are visited.
o Option : Find Shortest Path Dijkstras Algorithm
When this option is selected, the program should compute and print the shortest
paths from vertex to all other vertices using Dijkstra's algorithm.
o Option : Exit
When this option is selected, the program should exit.
examplegraph
sample output Menu: Display Adjacency List Perform BreadthFirst Search BFS Perform DepthFirst Search DFS Find Shortest Path using Dijkstra's Algorithm Exit Enter your choice: Adjacency List: Vertex : NULL Vertex : NULL Vertex : NULL Vertex : NULL Vertex : NULL Menu: Display Adjacency List Perform BreadthFirst Search BFS Perform DepthFirst Search DFS Find Shortest Path using Dijkstra's Algorithm Exit Enter your choice: Final BFS Order: Menu: Display Adjacency List Perform BreadthFirst Search BFS Perform DepthFirst Search DFS Find Shortest Path using Dijkstra's Algorithm Exit Enter your choice: Menu: Display Adjacency List Perform BreadthFirst Search BFS Perform DepthFirst Search DFS Find Shortest Path using Dijkstra's Algorithm Exit Enter your choice: Shortest distance from vertex to vertex : Shortest distance from vertex to vertex : Shortest distance from vertex to vertex : Shortest distance from vertex to vertex : Shortest distance from vertex to vertex : Menu: Display Adjacency List Perform BreadthFirst Search BFS Perform DepthFirst Search DFS Find Shortest Path using Dijkstra's Algorithm Exit Enter your choice: Exiting...
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
