private Graph<Integer> reverseGraph(Graph<Integer> graph) {
        Graph<Integer> reverseGraph = new Graph<>(true);
        for (Edge<Integer> edge : graph.getAllEdges()) {
            reverseGraph.addEdge(edge.getVertex2().getId(), edge.getVertex1()
                    .getId(), edge.getWeight());
        }
        return reverseGraph;
    }
Date 10/01/2014
@author Tushar Roy

Given a directed graph, find all strongly connected components in this graph.
We are going to use Kosaraju's algorithm to find strongly connected component.

Algorithm
Create a order of vertices by finish time in decreasing order.
Reverse the graph
Do a DFS on reverse graph by finish time of vertex and created strongly connected
components.

Runtime complexity - O(V + E)
Space complexity - O(V)

References
https://en.wikipedia.org/wiki/Strongly_connected_component
http://www.geeksforgeeks.org/strongly-connected-components/
src/com/interview/graph/StronglyConnectedComponent.java