Page 1 of 1

c++ In this assignment, you will construct an adjacency-list implementation of a directed, unweighted graph, and then us

Posted: Tue Jul 12, 2022 8:28 am
by answerhappygod
c++
In this assignment, you will construct an adjacency-listimplementation of a directed, unweighted graph, and then use it toimplement the breadth-first and depth-first search algorithms.
The Adjacency-List Graph Representation
Write an implementation of the adjacencylist graph representation. You may assume that nodes areintegers which start at 0. You should use the following graphclass:
You should save the above class definition into thefile graph.hpp.
Feel free to use the standard library queue class forimplementing the BFS, and to use the standard library list classes(list for doubly-linked, forward_list forsingly-linked) if you want.
When you compile, link with assign7_test.cpp. The testrunner will test the core functionality of your class, and willthen test both the BFS and DFS on the following graph:
although your graph should be able to workwith any directed graph. If you need a textualdescription of the graph:
Node 0 has an edge to node 2
Node 1 has an edge to node 0
Node 2 has an edge to node 1
Node 3 has edges to nodes 1, 2, and 4
Node 4 has edges to nodes 5 and 7
Node 5 has an edge to node 6
Node 6 has an edge to node 5
Node 7 has an edge to node 3
Node 8 has edges to nodes 7 and 9
Node 9 has an edge to node 7