title: Optimal way to calculate no.of ways to move from node i to i in less than k steps
body: <p>I have a n*n undirected graph. I have to find no of ways to move from some node to same in less than k steps. I need a approach faster than k*n^3.</p>