Question: Goal Design and implement an algorithm to input the data representation of two graphs, determine if the graphs are complements of each other and, if
Goal Design and implement an algorithm to input the data representation of two graphs, determine if the graphs are complements of each other and, if so, outputs a message that the graphs are complements then outputs the degrees of the vertices of each graph, otherwise outputs a message to the contrary and immediately terminates. Details Input to your program consists of the representation of two graphs and will be in the following format: an integer m representing the number of vertices of the first graph Gi . an adjacency matrix for Gi of m rows, each with, m entries. Each entry of the m xm adjacency matrix, will contain a 1 if there is an edge between the corresponding vertices or a 0 if there is no edge an integer n representing the number of vertices of the second graph G .an adjacency matrix for Gi of n rows, each with, n entries. Each entry of the n x n adjacency matrix, will contain a 1 if there is an edge between the corresponding vertices or a 0 if there is no edge There is a space following each number in the adjacency matrix, including the last number in each row. There is NOT a space in the first line indicating the size of the array Output is required to be formatted as in the examples below It is up to you to determine the best algorithm to accomplish this task. You MUST, however, use a 2-D array to represent the adjacency matrix in your program. It is very important that a 2-D array is used as it will be necessary in future labs. In addition, the elements of the 2-D array should be referenced at most once and if the graphs are not complementary the algorithm should terminate as soon as that is determined
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
