|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsalvo.jesus.graph.GraphImpl
salvo.jesus.graph.DirectedGraphImpl
salvo.jesus.graph.DirectedAcyclicGraphImpl
public class DirectedAcyclicGraphImpl
The DirectedAcyclicGraph class represents a directed acyclic graph (DAG) where there is no cyclic paths for any of its vertices. A cylic path is a path from a vertex back to itself by following the direction of the edges.
Field Summary | |
---|---|
(package private) TopologicalSorting |
topologicalsorting
Delegate object to handle topological sorting |
Fields inherited from class salvo.jesus.graph.DirectedGraphImpl |
---|
graphDirectionDelegate |
Fields inherited from class salvo.jesus.graph.GraphImpl |
---|
addedgelistener, addvertexlistener, connectedSetS, edges, removeedgelistener, removevertexlistener, traversal, vertices |
Constructor Summary | |
---|---|
DirectedAcyclicGraphImpl()
Creates a DirectedAcyclicGraph object. |
Method Summary | |
---|---|
void |
addEdge(Edge edge)
Adds an Edge into the DirectedAcyclicGraph. |
Edge |
addEdge(Vertex fromVertex,
Vertex toVertex)
Adds an Edge into the DirectedAcyclicGraph. |
java.util.Collection |
getRoot()
Returns a Vector of vertices that is not depended on by other vertices. |
java.util.Vector |
reverseTopologicalSort()
Perform a reverse topological sort of the entire directed acyclic graph. |
java.util.Vector |
reverseTopologicalSort(Vertex startat)
Perform a reverse topological sort of the connected set of a directed acyclic graph to which Vertex startat belongs, starting at Vertex startat. |
java.util.Vector |
topologicalSort()
Perform a topological sort of the entire directed acyclic graph. |
java.util.Vector |
topologicalSort(Vertex startat)
Perform a topological sort of the connected set of a directed acyclic graph to which Vertex startat belongs, starting at Vertex startat. |
Methods inherited from class salvo.jesus.graph.DirectedGraphImpl |
---|
add, clone, createEdge, getEdge, getIncomingAdjacentVertices, getIncomingEdges, getIncomingEdges, getOutgoingAdjacentVertices, getOutgoingEdges, getOutgoingEdges, isCycle, isPath, remove, removeEdge, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface salvo.jesus.graph.DirectedGraph |
---|
getEdge, getIncomingAdjacentVertices, getIncomingEdges, getOutgoingAdjacentVertices, getOutgoingEdges, isCycle, isPath |
Field Detail |
---|
TopologicalSorting topologicalsorting
Constructor Detail |
---|
public DirectedAcyclicGraphImpl()
Method Detail |
---|
public Edge addEdge(Vertex fromVertex, Vertex toVertex) throws java.lang.Exception
addEdge
in interface Graph
addEdge
in class DirectedGraphImpl
fromVertex
- Vertex that will be the origin of the Edge
that will be added into the Graph.toVertex
- Vertex that will be the destination of the Edge
that will be added into the Graph.
java.lang.Exception
public void addEdge(Edge edge) throws java.lang.Exception
addEdge
in interface Graph
addEdge
in class DirectedGraphImpl
e
- The edge to be added to the Graph.
java.lang.Exception
public java.util.Collection getRoot()
getRoot
in interface DirectedAcyclicGraph
public java.util.Vector topologicalSort()
topologicalSort
in interface DirectedAcyclicGraph
DirectedAcyclicGraph.reverseTopologicalSort()
public java.util.Vector reverseTopologicalSort()
reverseTopologicalSort
in interface DirectedAcyclicGraph
DirectedAcyclicGraph.topologicalSort()
public java.util.Vector topologicalSort(Vertex startat)
topologicalSort
in interface DirectedAcyclicGraph
startat
- The Vertex to which you want to start the traversal.
public java.util.Vector reverseTopologicalSort(Vertex startat)
reverseTopologicalSort
in interface DirectedAcyclicGraph
startat
- The Vertex to which you want to start the traversal.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |