Construct the graph
for ( int i = 0 ; i < edges . Count ; i ++ ) { ( ( ArrayList ) adj [ ( ( pair ) edges [ i ] ) . first ] ) . Add ( ( ( pair ) edges [ i ] ) . second ) ; ( ( ArrayList ) adj [ ( ( pair ) edges [ i ] ) . second ] ) . Add ( ( ( pair ) edges [ i ] ) . first ) ; }