Returns the type of edge edgeIndex.
Time: O(1).
edge index in 0..edgeCount-1
edge type
StaticofReturns the type of every edge of graph, from one depth-first search.
Time: O(nodeCount + edgeCount). Memory: edgeCount bytes for the result; while it runs, 4 bytes and 2 bits per node, and up to 8 x nodeCount bytes for the stack, which grows with the deepest path.
the graph to classify
the edge types
The type of every edge of a graph in a depth-first search: tree, back, forward or cross edge, as EdgeType defines them.
The types depend on the search. Uses a depth-first search, without recursion. The search starts at the nodes in ascending order and takes the out-nodes of each node in ascending order, as DfsTraverser.run does. EdgeTypes.typeOf returns the type of one edge, and Edges.of collects the edges of one type. Here,
cfgis the control flow of a method with a loop and a branch: the edgenext -> headercloses the loop, andbody -> nextskipsthen:A graph is a DAG (directed acyclic graph) exactly if it has no back edge. For the back edges alone, BackEdges.of saves the classification of the other edges.
Instances are immutable.
Memory: 1 byte per edge; an instance also keeps a reference to its graph.