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?


Browse other questions tagged or ask your own question.