Paths of Length r between Vertices
Theorem 2. Let G be a graph with adjacency matrix A with respect to the ordering v1 , v2 , . . . , vn . The number of different paths of length r from vi to vj , where r is a postive integer, equals the entry in row i and column j of Ar.
NOTE: This applies with directed or undirected edges, with multiple edges and loops allowed.