1. You will be given an graph represented in form of ArrayList<ArrayList<edge>>, where edge
is a user defined class (a type) which contains three Integer data members:
1st : v1 (denotes) vertex1.
2nd : v2 (denotes) vertex2.
3rd : wt (denotes the weight of edge b/w v1 and v2).
(we constructed this representation of graph in 1st question)
2. You will be given two Integer values a and b.
3. You have to complete allPaths() function, which prints all path b/w vertex a and vertex b .
4. You will need an extra parameter here so you have to declare that extra parameter in main and then replace it with ?(question mark sign) in main and allPaths() function.
5. Refer sample output for passing test cases.
Input Format
1.First line consist of two integer values a (vertex1) and b (vertex2) .
Output Format
boolean value (true or false).
Constraints
0<=a,b<graph size
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
0 6
Output
0 -> 3 -> 4 -> 5 -> 6 0 -> 3 -> 4 -> 6 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 0 -> 1 -> 2 -> 3 -> 4 -> 6