use adjacency matrix for floyd-warshall