Driver code
public static void Main ( string [ ] args ) { int N = 4 ; ArrayList adj = new ArrayList ( ) ; for ( int i = 0 ; i <= N + 1 ; i ++ ) adj . Add ( new ArrayList ( ) ) ; addEdge ( adj , 1 , 2 ) ; addEdge ( adj , 2 , 3 ) ; addEdge ( adj , 3 , 4 ) ; DFS ( adj , N ) ; } }