Driver code
static void Main ( ) { int [ , ] edges = { { 0 , 1 } , { 0 , 2 } , { 1 , 3 } , { 1 , 4 } , { 2 , 5 } , { 4 , 6 } , { 5 , 7 } } ; int E = edges . GetLength ( 0 ) ; int V = E + 1 ; int [ ] timeIn = new int [ V ] ; int [ ] timeOut = new int [ V ] ; preProcess ( edges , V , timeIn , timeOut ) ; int u = 1 ; int v = 6 ; Console . Write ( isAncestor ( u , v , timeIn , timeOut ) + " STRNEWLINE " ) ; u = 1 ; v = 7 ; Console . Write ( isAncestor ( u , v , timeIn , timeOut ) + " STRNEWLINE " ) ; } }