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

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.