Question: Please provide screenshots from IDE Write a C Program Given a graph with nodes (vertices) 1.....n, the adjacency matrix of a graph is a matrix
Please provide screenshots from IDE
Write a C Program Given a graph with nodes (vertices) 1.....n, the adjacency matrix of a graph is a matrix of 1's and O's such that if element aij 1 then there is a link between nodes i and j where iS1, jn. For example, the adjacency matrix of the following graph: 4 2 1 1 The transitive closure of this matrix is 0 1 0, 0 Algorithm Warshall Input: The adjacency matrix of a relation R on a set with n elements. Output: The adjacency matrix T of the transitive closure of R. Procedure: Start with T-A. For each j from 1 to n For each i from 1 to n If T(i,j)-1, then form the Boolean or of row i and row j and replace row i by it. Go on to the next i-value Once you have processed each i-value, go on to the next j-value. The input is the number of nodes in the graph n followed by the n2 elements of the matrix Input Output 6 0 1 00 1 0 0 100 1 0 0 000 1 0 01 0 0 0 0 1 01 0 0 0 0 1 0 0 0 0 1 00 0 1 0 0 1001 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
