connectivity matrix
number of steps between verteces
How many steps does it take to go between two verteces of the square pyramid? And how many paths can you take to go between them in a certain number of steps?
Raise the connectivity matrix to a chosen power and read the answer in the matrix. You can examine and check the answer in the 3d view.