Class GraphCycles<N>
java.lang.Object
org.ek9lang.compiler.support.GraphCycles<N>
- Type Parameters:
N- the type of a node
- All Implemented Interfaces:
BiFunction<Collection<N>, Function<N, ? extends Collection<N>>, List<StronglyConnectedComponents.Component<N>>>
public final class GraphCycles<N>
extends Object
implements BiFunction<Collection<N>, Function<N, ? extends Collection<N>>, List<StronglyConnectedComponents.Component<N>>>
THE cycles of a directed graph: only the components of
StronglyConnectedComponents (THE Tarjan - iterative,
successors asked lazily, self-loops kept) that are cycles. Use it wherever a phase needs a graph's cycles, never a
private copy.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(Collection<N> roots, Function<N, ? extends Collection<N>> successors) Only the components reachable from the roots that are cycles.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
GraphCycles
public GraphCycles()
-
-
Method Details
-
apply
public List<StronglyConnectedComponents.Component<N>> apply(Collection<N> roots, Function<N, ? extends Collection<N>> successors) Only the components reachable from the roots that are cycles.- Specified by:
applyin interfaceBiFunction<Collection<N>, Function<N, ? extends Collection<N>>, List<StronglyConnectedComponents.Component<N>>>- Parameters:
roots- where the search startssuccessors- the nodes a node has an edge to; asked once per node reached- Returns:
- the cyclic components, in the order
StronglyConnectedComponentsfinds them
-