public abstract class CyclicGraphDetector<N> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CyclicGraphDetector.CycleDetectedException |
Constructor and Description |
---|
CyclicGraphDetector() |
Modifier and Type | Method and Description |
---|---|
protected abstract Iterable<? extends N> |
getEdges(N n)
List up edges from the given node (by listing nodes that those edges point to.)
|
List<N> |
getSorted()
Returns all the nodes in the topologically sorted order.
|
protected void |
reactOnCycle(N q,
List<N> cycle)
React on detected cycles - default implementation throws an exception.
|
void |
run(Iterable<? extends N> allNodes) |
public void run(Iterable<? extends N> allNodes) throws CyclicGraphDetector.CycleDetectedException
public List<N> getSorted()
protected abstract Iterable<? extends N> getEdges(N n)
protected void reactOnCycle(N q, List<N> cycle) throws CyclicGraphDetector.CycleDetectedException
q
- cycle
- CyclicGraphDetector.CycleDetectedException
Copyright © 2004–2021. All rights reserved.