A utility function to print the adjacency list representation of graph
def printGraph ( adj , V ) : NEW_LINE INDENT for v in range ( 0 , V ) : NEW_LINE INDENT print ( " Adjacency ▁ list ▁ of ▁ vertex " , v ) NEW_LINE print ( " head " , end = " ▁ " ) NEW_LINE for x in adj [ v ] : NEW_LINE INDENT print ( " - > " , x , end = " " ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT DEDENT