Driver Code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT edges = [ ( 0 , 1 ) , ( 0 , 2 ) , ( 1 , 3 ) , ( 1 , 4 ) , ( 2 , 5 ) , ( 4 , 6 ) , ( 5 , 7 ) ] NEW_LINE E = len ( edges ) NEW_LINE V = E + 1 NEW_LINE timeIn = [ 0 ] * V NEW_LINE timeOut = [ 0 ] * V NEW_LINE preProcess ( edges , V , timeIn , timeOut ) NEW_LINE u = 1 NEW_LINE v = 6 NEW_LINE print ( isAncestor ( u , v , timeIn , timeOut ) ) NEW_LINE u = 1 NEW_LINE v = 7 NEW_LINE print ( isAncestor ( u , v , timeIn , timeOut ) ) NEW_LINE DEDENT