Question: Q2) A: Returns all the vertices in the graph that are reachable from the given {source} vertex. vectorint > get_reachable_from ( int source) const B:





You are given an incomplete class in graph.h representing a directed weighted graph. The graph is represented using an adjacency list that stores objects of type Edge in the adjacency list of each vertex. Each Edge object represents a directed weighted edge, storing the weight, the source vertex (from) and the destination vertex (to). 8 2 frono to a weight 4 from o to 1 weight 7 from @ to 2 weight from 1 1 5 5 4 6 2 2 -:- 3 0 0 from = 0 to 3 weight = 4 from = 0 to 11 weight = 7 from = @ to = 2 weight = 5 1 from = 1 to = 3 weight = 6 N 3 from = 3 to - 1 weight = 2 from = 3 to 22 weight = 1 int V; 24 // Represents a directed weighted graph. Can also 25 // be used to represent an undirected weighted graph. 26 class Graph { 27 private: 28 // number of vertices 29 list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
