Handle edge case of node having directed edge to itself.