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 )

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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?
Transcribed Image Text: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?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Polynomial time
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education