Building a undirected graph
static void buildGraph ( int [ ] x , int [ ] y , int len ) { for ( int i = 0 ; i < len ; i ++ ) { int p = x [ i ] ; int q = y [ i ] ; Graph [ p ] . Add ( q ) ; Graph [ q ] . Add ( p ) ; } }