The input file is : 4 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 6 0 1 0 1 1 0 1 0 0 1 1 0
ID: 3597658 • Letter: T
Question
The input file is :
4
0 1 1 0
1 1 1 1
1 0 0 0
1 1 0 1
6
0 1 0 1 1 0
1 0 0 1 1 0
0 0 1 0 0 1
0 0 0 0 1 0
1 0 0 0 0 0
0 0 1 0 0 1
3
0 1 1
1 0 1
1 1 0
For example, for the third 3x3 matrix, the output should be:
Path from 1 to 1:
1-2-1, 1-3-1, 1-2-3-1, 1-3-2-1
Path from 1 to 2:
1-2, 1-3-2
Path from 1 to 3:
1-3,1-2-3
Path from 2 to 1:
Xxxxxxxxxxx
Path from 2 to 2:
Xxxxxxxxxxxx
Path from 2 to 3:
Xxxxxxxxxxxxx
Path from 3 to 1:
Xxxxxxxxxxxx
Path from 3 to 2:
Xxxxxxxxxxxx
Path from 3 to 3:
xxxxxxxxxxxx
The output should be writing to a text file, not printing a console.
Use recursion to find and list all possible non-looping paths between all possible pairs of nodes from the following input file. It is ok if the start and end nodes are the same but otherwise the No Path Found Check out all possible paths in each graph You should save the following input as a txt file. Use I O to read an adjacency matrix from the file and process the graph to find all paths, then read new adjacency matrix until the file is empty. Use array to store the adjacency matrix. Do not use Java Library, such as Array list and stack.Explanation / Answer
Path from 1 to 1:
1-2-1, 1-3-1, 1-2-3-1, 1-3-2-1
Path from 1 to 2:
1-2, 1-3-2
Path from 1 to 3:
1-3,1-2-3
Path from 2 to 1:
Xxxxxxxxxxx
Path from 2 to 2:
Xxxxxxxxxxxx
Path from 2 to 3:
Xxxxxxxxxxxxx
Path from 3 to 1:
Xxxxxxxxxxxx
Path from 3 to 2:
Xxxxxxxxxxxx
Path from 3 to 3:
xxxxxxxxxxxx
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.