salvo.jesus.graph
Interface DirectedAcyclicGraph

All Superinterfaces:
DirectedGraph, Graph, java.io.Serializable
All Known Implementing Classes:
DirectedAcyclicGraphImpl

public interface DirectedAcyclicGraph
extends DirectedGraph

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.

Author:
Jesus M. Salvo Jr.

Method Summary
 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 interface salvo.jesus.graph.DirectedGraph
getEdge, getIncomingAdjacentVertices, getIncomingEdges, getOutgoingAdjacentVertices, getOutgoingEdges, isCycle, isPath
 
Methods inherited from interface salvo.jesus.graph.Graph
add, addEdge, addEdge, addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, cloneVertices, createEdge, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getTraversal, getVertices, getVerticesCount, getVerticesIterator, isConnected, mergeconnectedSet, remove, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, setTraversal, traverse
 

Method Detail

getRoot

java.util.Collection getRoot()
Returns a Vector of vertices that is not depended on by other vertices. That is, a Vector of vertices where there are no Edges pointing to it.

Returns:
Vector of vertices

topologicalSort

java.util.Vector topologicalSort()
Perform a topological sort of the entire directed acyclic graph. Note that the sequence of vertices in the return Vector will not distinguish between connected components of the graph.

Returns:
Vector containing the sequence of the vertices visited in the entire graph, regardless of the connected components of the graph.
See Also:
reverseTopologicalSort()

reverseTopologicalSort

java.util.Vector reverseTopologicalSort()
Perform a reverse topological sort of the entire directed acyclic graph. Note that the sequence of vertices in the return Vector will not distinguish between connected components of the graph. This simply calls topologicalSort() and reverses the sequence of vertices visited.

Returns:
Vector containing the sequence of the vertices visited in the entire graph, regardless of the connected components of the graph.
See Also:
topologicalSort()

topologicalSort

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.

Parameters:
startat - The Vertex to which you want to start the traversal.
Returns:
A Vector of vertices in the order that they were visited.

reverseTopologicalSort

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. This method is not part of the GraphTraversal abstract class, but is added here for convenience.

Parameters:
startat - The Vertex to which you want to start the traversal.
Returns:
A Vector of vertices in the order that they were visited.