Returns true if there is a path from source to target.
Returns true if there is a path from source to target.
A function giving the nodes directly accessible from a given node
Returns the set of reachable nodes from a given node, not including the node itself (unless it is member of a cycle)
Returns the set of reachable nodes from a given node, not including the node itself (unless it is member of a cycle)
A function giving the nodes directly accessible from a given node
The source from which to begin the search
Takes an graph in form of a map (vertex -> out neighbors).
Takes an graph in form of a map (vertex -> out neighbors). Returns a topological sorting of the vertices (Right value) if there is one. If there is none, it returns the set of vertices that belong to a cycle or come before a cycle (Left value)