given a graph G,a matrix Pk represent a matrix in which each entry pk[i][j] represent the shortest path from node i to node j in G which uses only nodes 1,2,3.............k-1 .The corresponding graph formed by using matrix Pk[i][j] is termed as Gk .
Gk can be calculated by taking the square of adjacency matrix of G k times and replacing each multiplication and addittion operation by AND and OR operation.(concept of warshall's algorithm of unweighted graph) .now my question is how to find Gk if the graph G is represented by using adjacency list and what will be the time complexity to do it ??