Question: C++ 2DArrays binary relations The program you write for this lab will read in the number of nodes and a binary relation representing a graph.
C++ 2DArrays
binary relations
The program you write for this lab will read in the number of nodes and a binary relation representing a graph. The program will create an adjacency matrix from the binary relation. The program will then print the adjacency matrix and whether or not an Euler path exists. There will be no more than 10 nodes, and you must use a 10X10 2D array for the adjacency matrix. Note: There is no reason to store the binary relation. Just create the 2D array as you read (so no getline into a string that you then parse). Second note: There are no spaces in the binary relation. Note also that the numbers could be two digits since 10 nodes is possible, so I would read the numbers as ints and the {,()}'s as chars.
Sample Run
How many nodes are in the graph? 6
Please input the binary relation for the graph:
{(1,2),(1,5),(2,1),(2,3),(3,2),(3,4),(4,3),(4,5),(5,1),(5,4)}
The adjacency matrix is:
0 1 0 0 1 0
1 0 1 0 0 0
0 1 0 1 0 0
0 0 1 0 1 0
1 0 0 1 0 0
0 0 0 0 0 0
An Euler path does exist in the graph.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
