Since edge u is removed , update the indegrees of all the nodes which had an incoming edge from u
for x in adj [ u ] : NEW_LINE INDENT indeg [ x ] -= 1 NEW_LINE if ( indeg [ x ] == 0 ) : NEW_LINE INDENT q . appendleft ( x ) NEW_LINE DEDENT DEDENT return res NEW_LINE