ConstReturns the back edges of graph, in the order in which the search finds them.
Unlike the other results that list edges, they do not come in edge index order. For that
order, use Edges.of(EdgeTypes.of(graph), EdgeType.BACK): the same edges, at the cost of
classifying every edge first.
Time: O(nodeCount + edgeCount). Memory: 12 bytes per back edge for the result; while it runs, up to 18 bytes more per back edge, 2 bits per node and up to 8 x nodeCount bytes for the stack, which grows with the deepest path.
the graph to search
the back edges with their edge indices
The back edges of a graph: the edges that a depth-first search finds pointing back to a node on its current path, self-loops included.
Every cycle contains a back edge, so a graph without back edges is a DAG (directed acyclic graph), and removing the back edges of a graph leaves a DAG. They form a feedback arc set, though not in general a smallest one.
Uses the depth-first search of EdgeTypes.of, without recursion: BackEdges.of finds the edges that
EdgeTypesclassifies as EdgeType.BACK, without classifying the others.