Class DirectedGraph<T>
- java.lang.Object
-
- de.bmiag.tapir.execution.plan.sort.DirectedGraph<T>
-
- Type Parameters:
T
- type of elements which act as nodes in the graph
public class DirectedGraph<T> extends java.lang.Object
Representation of a directed graph which can be sorted by callingsort()
.- Since:
- 2.0.0
- Author:
- Oliver Libutzki
-
-
Constructor Summary
Constructors Constructor Description DirectedGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(T source, T target)
CallsaddNode(Object)
for source and target and adds the edge to the graph.void
addNode(T node)
Adds the given node to the graphjava.util.Collection<T>
getEdgeTargetsFrom(T source)
Returns all the targets of the edges starting at the given source.java.util.List<T>
sort()
Execute topological sort by usingsortInternal(Object, Set, Stack)
recursively.
-
-
-
Method Detail
-
addNode
public void addNode(T node)
Adds the given node to the graph- Parameters:
node
- the node to be added- Since:
- 2.0.0
-
addEdge
public void addEdge(T source, T target)
CallsaddNode(Object)
for source and target and adds the edge to the graph.- Parameters:
source
- the source nodetarget
- the target node- Since:
- 2.0.0
-
getEdgeTargetsFrom
public java.util.Collection<T> getEdgeTargetsFrom(T source)
Returns all the targets of the edges starting at the given source.- Parameters:
source
- the source node- Returns:
- the target nodes
- Since:
- 2.0.0
-
sort
public java.util.List<T> sort()
Execute topological sort by usingsortInternal(Object, Set, Stack)
recursively.- Returns:
- the sorted node list
- Since:
- 2.0.0
-
-