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.
![Figure 6.6.2: A directed graph and the corresponding adjacency matrix.
AB= 2 means A
AK
So the graph looks like this
BA= 2 means
ek
B
2
3
The directed graph's edge, highlighted in blue, goes from vertex 3 to vertex 1. The corresponding entry in the adjacency matrix shows a
1 in row 3, column 1.
B
ܘܢ
B
-TON
This is what it looks like when you have two arrows going one direction based on a matrix (courtesy of Dang Truong).
1100
2
لمات °°
0 0
Matrix
A B
A1 2
B20
Feedback?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd20c9d63-395d-4692-a314-612694e3f8ce%2F5c85227c-f352-4bab-9909-d7e42c133ce6%2F03owk8r_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)