Question
need help with Breadth for Search c++ 1.First of all is using adjacency list, basically using #include , is basically a standard library ? 2.
need help with Breadth for Search c++
1.First of all is using adjacency list, basically using #include , is basically a standard library ?
2. Help me with an algorithm/pseudocode/a simple code(most preferred) on how to get the NUMBER OF ALL PATHS WITH GIVEN LENGTH, N, in a given UNDIRECTED & UNWEIGHTED graph. The vertices are stored in adjacency list format... So how would I can et all the number of path of fixed length from one vertices to another vertices, AND THESE PATH LENGTHS ARE THE SHORTEST LENGTH TO GET FROM ONE VERTICES TO THE OTHER.
So let's say from 0 vertices to 5 vertices, there are 4 ways to do this. The first way require a path length of 4, the second way requires a path length of 5, third way requires a path length of only 1, and the fourth way also requires only path length of 1.. So now I want to get the number of paths of a given SHORTEST path length,n. So basically n is equals to 1, because that's the shortest paths to get from vertices 0 to vertices 5. Then, the answer/result for the number of paths of a given SHORTEST path length,n - where n is equals to 1-, will be 2 (since there's two ways for the vertices 0 to reach vertices 5 with path length of 1). So now please give a clear explanation of what to do (please use visualization drawings as necessary as this help me to understand better).
REMEMBER: this is in the form of adjacency list! and it is an UNDIRECTED and UNWEIGHTED graph.
Example test cases that has to be pass (in which I have to make the function definition for countingGraphPathWays ):
TRY(GraphingTester, GraphingTesterA) { std::vector< std::vector
std::vector
//the function: countingGraphPathWays(const vector< vector
//thePathLen = path lengths is basically the shortest length to reach from the source vertex to the destination vertex
std::vector
EXPECT_TRUE(thePathLen ==expectedOfThePathLen && expectedOfNumberShortestPath ==numOfTheShortestPaths);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started