Question: c++||please do not share solution class Graph! int V; 1 No. of vertices list int> *adj; public: Graph (int V) this-> VV: adj = new
class Graph! int V; 1 No. of vertices list int> *adj; public: Graph (int V) this-> VV: adj = new list int>[V]; 1 -Graph() | delete adj;) void addEdge (int v, int w) adj[v] .push_back (w): 1 Answer the following questions using the above class. You are allowed to add public or private member functions as needed. (20 points) Back Edges Implement the member function void Graph: :printAllBackEdges (). This function prints all back edges in the current graph. (20 points) Undirected Graph Implement the member function bool Graph::isUndirectedGraph(). This function checks if the graph can be treated as an undirected graph. (Hint: if for every edge (u, ) in the graph the edge vu) also exists, then the graph can be treated as an undirected graph) (20 points) Given a directed graph, describe an efficient algorithm for checking if there is a vertex v in the graph from which all other vertices are reachable. What is the order of growth of the running time of your algorithm in the worst case? (Note: inefficient algorithms will receive partial credit)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
