public boolean[][] getTransitiveClosure(int [][]graph){
        int rows = graph.length;
        int cols = graph[0].length;
        boolean[][] result = new  boolean[rows][cols];

        for(int i = 0; i < graph.length; i++){
            for(int j=0; j < graph.length; j++){
                if(graph[i][j] != 100){
                    result[i][j] = true;
                }
            }
        }
        for(int i=0; i < rows; i++){
            for(int j=0 ; j < rows; j++){
                for(int k=0; k < rows; k++){
                    result[i][j] = result[i][j] || (result[i][k] && result[k][j]);
                }
            }
        }
        return result;
    }
http://www.geeksforgeeks.org/transitive-closure-of-a-graph/
src/com/interview/graph/TransitiveClosure.java