Add all adjacent nodes to the node in the graph
Dictionary < int , ArrayList > graph = new Dictionary < int , ArrayList > ( ) ; Dictionary < int , ArrayList > graph_rev = new Dictionary < int , ArrayList > ( ) ; for ( int i = 0 ; i < edges . Count ; i ++ ) { int x = ( int ) ( ( ArrayList ) edges [ i ] ) [ 0 ] ; int y = ( int ) ( ( ArrayList ) edges [ i ] ) [ 1 ] ;