How do I do the following? I am beyond lost. Just inform me of whatever you can. I know noone will do it all
Here is what problem 21 states:
If A is an n x n adjacency matrix for a directed graph, then the entry in the ith row andjth column of A^k is equal to the number of paths of length k from the ith vertex to the jth vertex in this graph. The reachability matrix for a directed diagraph.The reachability matrix R of a diagraph is the n x n matrix defined by
R = I + A + A^2 + ... + A^(n-1)
Where I is the n x n identity matrix having ones on the diagonal ( from upper left corner to lower right corner) and zeros off. In the diagraph, there is a path from vertex i to vertex j if and only if the entry in row i and column j of R is nonzero. Write a function to find the reachablility matrix for a directed graph.
1. [Searching and Traversing Digraphs]
a)Do problem 21 from page 910 of the textbook
You must define a Matrix Abstract Data Type.
You must use templates to make it as generic as possible.
Use a two-dimensional, dynamically allocated array to implement your Matrix ADT.
You must declare and implement:
o one or more constructors,
o a destructor,
o the operators +, *, =,
o a showStructure (or print ) function to show your matrices
o a function to create the identity matrix
o a function to set the adjacency matrix
o a function Reach to compute the reachability matrix R