public static void main(String args[]){
        int[][] graph = {
                {0,   3,   6,   15},
                {INF, 0,  -2,   INF},
                {INF, INF, 0,   2},
                {1,   INF, INF, 0}
        };

        FloydWarshallAllPairShortestPath shortestPath = new FloydWarshallAllPairShortestPath();
        int[][] distance = shortestPath.allPairShortestPath(graph);
        System.out.println("Minimum Distance matrix");
        for(int i=0; i < distance.length; i++){
            for(int j=0; j < distance.length; j++){
                System.out.print(distance[i][j] + " ");
            }
            System.out.println("");
        }
    }
Date 11/02/2015
@author Tushar Roy

Floyd-Warshall Algorithm for finding all pair shortest path.

Time complexity - O(V^3)
Space complexity - O(V^2)

References
https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm
src/com/interview/graph/FloydWarshallAllPairShortestPath.java