write a java program that outputs a walk, trail, path, closed walk, circuit, and cycle of a given directed graph matrix. That matrix is to be hard coded as such... There are 4 vertices in this directed graph. We know that because there are 4 rows and 4 columns. If there is a 1 that means that the vertex on the left (you need to name them) has an arrow edge towards the vertex on the top. If there is a 2 that means there are two directed edges in the same direction going from the left vertex to the vertex on the top. If there is a 0 that means there are no edges from the vertex on the left to the top vertex. 1 2 2 1 2 1 2 1 2 2 1 2 1 1 1 0 - Make sure to program the matrix in to your code. - Output an example of each, make sure they are labeled. (6 outputs )
write a java program that outputs a walk, trail, path, closed walk, circuit, and cycle of a given directed graph matrix. That matrix is to be hard coded as such...
There are 4 vertices in this directed graph. We know that because there are 4 rows and 4 columns. If there is a 1 that means that the vertex on the left (you need to name them) has an arrow edge towards the vertex on the top. If there is a 2 that means there are two directed edges in the same direction going from the left vertex to the vertex on the top. If there is a 0 that means there are no edges from the vertex on the left to the top vertex.
1 | 2 | 2 | 1 |
2 | 1 | 2 | 1 |
2 | 2 | 1 | 2 |
1 | 1 | 1 | 0 |
- Make sure to program the matrix in to your code.
- Output an example of each, make sure they are labeled. (6 outputs )
Example of a directed graph matrix below. The red numbers around the matrix are the vertices. If there is a 0 it means there is no edge from the vertex on the right to the vertex on the top.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images