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.
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
o etc.

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by smoothe19

Seems pretty straight forward to me??

What's the problem.

I don't know how to begin and it's my exam i don't want to fail!... C++ is so hard!

Edited by smoothe19: n/a

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.
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
o etc.

Even if u were gonna put up ur assignment for solving, u didn't have to give us the page and number.. we don't need it. Try solving ur work urself..We would help u i we see some efforts.

I did give the page and page number. This is exactly what it says

"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."

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.