Given edges to the graph
ArrayList edges = new ArrayList ( ) { new ArrayList ( ) { 0 , 1 } , new ArrayList ( ) { 1 , 3 } , new ArrayList ( ) { 2 , 3 } , new ArrayList ( ) { 4 , 0 } , new ArrayList ( ) { 4 , 5 } } ;