If current node has not any neighbour add it to path and pop stack set new current to the popped element
if ( sum ( graph [ cur ] ) == 0 ) : NEW_LINE INDENT path . append ( cur ) NEW_LINE cur = stack [ - 1 ] NEW_LINE del stack [ - 1 ] NEW_LINE DEDENT