building a undirected graph
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 ] . push_back ( q ) ; Graph [ q ] . push_back ( p ) ; } }