public static void main(String args[]){
        Graph<Integer> graph = new Graph<>(false);
        graph.addEdge(1, 2);
        graph.addEdge(2, 3);
        graph.addEdge(1, 3);
        graph.addEdge(1, 4);
        graph.addEdge(4, 5);
        graph.addEdge(5, 6);
        graph.addEdge(6, 7);
        graph.addEdge(7, 5);
        graph.addEdge(6, 8);

        //bigger example
        /*
        graph.addEdge(0, 1);
        graph.addEdge(0, 2);
        graph.addEdge(0, 3);
        graph.addEdge(0, 4);
        graph.addEdge(4, 2);
        graph.addEdge(3, 5);
        graph.addEdge(4, 6);
        graph.addEdge(6, 3);
        graph.addEdge(6, 7);
        graph.addEdge(6, 8);
        graph.addEdge(7, 9);
        graph.addEdge(9, 10);
        graph.addEdge(8, 10);*/

        ArticulationPoint<Integer> ap = new ArticulationPoint<Integer>();
        Set<Vertex<Integer>> aPoints = ap.findarticulationPoints(graph);
        aPoints.forEach(point -> System.out.println(point));
    }
Date 08/22/2015
@author Tushar Roy

Find articulation points in connected undirected graph.
Articulation points are vertices such that removing any one of them disconnects the graph.

We need to do DFS of this graph and keep visitedTime and lowTime for each vertex.
lowTime is keeps track of back edges.

If any one of following condition meets then vertex is articulation point.

1) If vertex is root of DFS and has atlesat 2 independent children.(By independent it means they are
not connected to each other except via this vertex). This condition is needed because if we
started from corner vertex it will meet condition 2 but still is not an articulation point. To filter
out those vertices we need this condition.

2) It is not root of DFS and if visitedTime of vertex <= lowTime of any adjacent vertex then its articulation point.

Time complexity is O(E + V)
Space complexity is O(V)

References:
https://en.wikipedia.org/wiki/Biconnected_component
http://www.geeksforgeeks.org/articulation-points-or-cut-vertices-in-a-graph/
src/com/interview/graph/ArticulationPoint.java