don't rely on removing explored edges in topsort
don't rely on removing explored edges in topsort

Summary:
Removing explored edges was a way to ensure that edges are not explored twice. But this operation is
not only O(log N), which can be expensive for large graphs, but also creates intermediate maps which
causes memory pressure.

Since we already track which nodes have been visited, we can do away with this operation, replacing
it with a O(1) membership check.

Reviewed By: gabelevi

Differential Revision: D8000850

fbshipit-source-id: 97b7e88293e1e3a938026577462e679b29f286af

JonathanUsername/flow,claudiopro/flow,nmote/flow,JonathanUsername/flow,claudiopro/flow,facebook/flow,gabelevi/flow,jamesgpearce/flow,mroch/flow,popham/flow,nmote/flow,nmote/flow,AgentME/flow,popham/flow,samwgoldman/flow,popham/flow,facebook/flow,samwgoldman/flow,gabelevi/flow,JonathanUsername/flow,gabelevi/flow,popham/flow,jamesgpearce/flow,mroch/flow,JonathanUsername/flow,facebook/flow,nmote/flow,AgentME/flow,claudiopro/flow,claudiopro/flow,facebook/flow,samwgoldman/flow,popham/flow,facebook/flow,gabelevi/flow,mroch/flow,samwgoldman/flow,AgentME/flow,samwgoldman/flow,gabelevi/flow,facebook/flow,jamesgpearce/flow,facebook/flow,mroch/flow,popham/flow,AgentME/flow,mroch/flow,AgentME/flow,samwgoldman/flow,JonathanUsername/flow,jamesgpearce/flow,nmote/flow,gabelevi/flow,JonathanUsername/flow,popham/flow,nmote/flow,mroch/flow,nmote/flow,samwgoldman/flow,jamesgpearce/flow,jamesgpearce/flow,mroch/flow,claudiopro/flow,JonathanUsername/flow,gabelevi/flow,jamesgpearce/flow