1

I have an adjacency matrix, call it A, representing a directed graph. I want to find all paths of length k. I know that A^k gives me the number of paths of length k between i and j, for each entry (i, j). But I want to know the actual edges in these k-length paths.

What's the best way to find all k-length paths in my graph? I read somewhere that exhaustive search on the adjacency matrix is the best way—but if so, how exactly to go about this?

ktm5124
  • 173
  • 6
  • See also http://cs.stackexchange.com/q/19761/755 and http://cs.stackexchange.com/q/21381/755 for related problems (but not identical). – D.W. Aug 10 '15 at 02:51
  • in https://cs.stackexchange.com/questions/44281 a BFS search was suggested. – Ran G. Aug 10 '15 at 03:09
  • It depends on your expectation of a "non-exhaustive" method. Do you need a magical poly-logarithmic algorithm or an $O(nm)$ solution makes you happy? – orezvani Aug 10 '15 at 06:16

0 Answers0