salvo.jesus.graph
Interface DirectedGraph

All Superinterfaces:
Graph, java.io.Serializable
All Known Subinterfaces:
DirectedAcyclicGraph, DirectedGraphWithDict
All Known Implementing Classes:
CallGraph, CondensedGraph, DirectedAcyclicGraphImpl, DirectedGraphImpl, DirectedGraphWeakImpl, DirectedGraphWithDictImpl

public interface DirectedGraph
extends Graph

A directed Graph where edges have a specified direction. Edges in this graph are therefore instances of DirectedEdge.

Author:
Jesus M. Salvo Jr.

Method Summary
 DirectedEdge getEdge(Vertex fromvertex, Vertex tovertex)
          Returns an Edge in the Graph whose origin is fromVertex and destination is toVertex.
 java.util.Collection getIncomingAdjacentVertices(Vertex v)
          Returns the vertices that are adjacent to a specified Vertex where the Edge is incoming from the specified Vertex to the adjacent vertex.
 java.util.Collection getIncomingEdges(Vertex v)
          Returns the incoming edges of a particular Vertex in the Graph.
 java.util.Collection getOutgoingAdjacentVertices(Vertex v)
          Returns the vertices that are adjacent to a specified Vertex where the Edge is outgoing from the specified Vertex to the adjacent vertex.
 java.util.Collection getOutgoingEdges(Vertex v)
          Returns the outgoing edges of a particular Vertex in the Graph.
 boolean isCycle(Vertex fromVertex)
          Determines if there is a cycle from Vertex fromVertex.
 boolean isPath(Vertex fromVertex, Vertex toVertex)
          Determines if there is a path from Vertex fromVertex to Vertex toVertex.
 
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

getOutgoingEdges

java.util.Collection getOutgoingEdges(Vertex v)
Returns the outgoing edges of a particular Vertex in the Graph.

Parameters:
v - Vertex you want to determine its outgoing edges.
Returns:
Collection of outgoing edges of the specified Vertex.

getIncomingEdges

java.util.Collection getIncomingEdges(Vertex v)
Returns the incoming edges of a particular Vertex in the Graph.

Parameters:
v - Vertex you want to determine its incoming edges.
Returns:
Collection of incoming edges of the specified Vertex.

getOutgoingAdjacentVertices

java.util.Collection getOutgoingAdjacentVertices(Vertex v)
Returns the vertices that are adjacent to a specified Vertex where the Edge is outgoing from the specified Vertex to the adjacent vertex.

Parameters:
v - Vertex you want to determine its outgoing adjacent vertices.
Returns:
Collection of outgoing vertices adjacent to the specified Vertex.

getIncomingAdjacentVertices

java.util.Collection getIncomingAdjacentVertices(Vertex v)
Returns the vertices that are adjacent to a specified Vertex where the Edge is incoming from the specified Vertex to the adjacent vertex.

Parameters:
v - Vertex you want to determine its incoming adjacent vertices.
Returns:
Collection of incoming vertices adjacent to the specified Vertex.

getEdge

DirectedEdge getEdge(Vertex fromvertex,
                     Vertex tovertex)
Returns an Edge in the Graph whose origin is fromVertex and destination is toVertex. If there is more than one Edge that has the same origin and destination in the Graph, the first matching Edge is returned.

Parameters:
fromVertex - Vertex that is the origin of the directed Edge
toVertex - Vertex that is the destination of the directed Edge
Returns:
Edge whose origin is fromVertex and destination is toVertex
See Also:
Edge

isPath

boolean isPath(Vertex fromVertex,
               Vertex toVertex)
Determines if there is a path from Vertex fromVertex to Vertex toVertex. This will not return true if the only path has at least one Edge pointing in the opposite direction of the path.

Parameters:
fromVertex - starting Vertex for the path
toVertex - ending Vertex for the path
Returns:
true if there is a path from Vertex to toVertex. false otherwise.

isCycle

boolean isCycle(Vertex fromVertex)
Determines if there is a cycle from Vertex fromVertex. A cycle occurs when there is a path from the specified Vertex back to itself, taking into consideration that direction of the Edges along the path. This simply calls isPath(), where both parameters are the same Vertex.

Parameters:
fromVertex - Vertex to be tested for a cycle path.
Returns:
true if there is a cycle path from fromVertex to itself.