public static void main(String args[]){
        TransitiveClosure closure = new TransitiveClosure();
        int[][] graph = {{0,2,2,4,100},{100,0,100,1,100},{100,100,0,3,100},{100,100,3,0,2},{100,3,100,100,0}};
        boolean result[][] = closure.getTransitiveClosure(graph);
        for(int i=0; i < result.length; i++){
            for(int j=0; j < result.length; j++){
                System.out.print(result[i][j] + " ");
            }
            System.out.println();
        }
    }
http://www.geeksforgeeks.org/transitive-closure-of-a-graph/
src/com/interview/graph/TransitiveClosure.java