views:

83

answers:

3
+1  Q: 

adjacency matrix

my question is given an adjacency matrix of a graph and a positive interger n find the number of path of length n between two vertices,i don't know how to convert to programming? somebody can help me.

+1  A: 

Take A^n then read the appropriate entry.

If you want it more efficient for single vertices, do a random walker starting at first vertex for n iterations.

ypnos
+1  A: 

I'm assuming this is homework, so here's a hint. If you were given a pencil and paper, and a small adjacency matrix, how would you count the number of paths?

Stephen C
Thomas Matthews
A: 
iera