ls
Class DirectedGraph

java.lang.Object
  |
  +--ls.Graph
        |
        +--ls.DirectedGraph

public class DirectedGraph
extends Graph

This is a representation of a graph that has directed edges. It is derived from the Graph class. It contains the same functionality as the Graph class, but with the exception that the edges are directional.


Fields inherited from class ls.Graph
edges, vertices
 
Constructor Summary
DirectedGraph()
          Creates a new directed graph.
 
Method Summary
 void addEdge(java.lang.Object parent, java.lang.Object child)
          Adds a directed edge to the graph.
 void addEdge(Vertex parent, Vertex child)
          Adds a directed edge between two vertices to the graph.
 boolean existsEdge(Edge e)
          Checks to see of an edges exists in this graph.
 java.util.Vector getChildren(Vertex v)
          Returns all the children of a particular vertex in the graph.
 java.util.Vector getParents(Vertex v)
          Returns all of the parents associated with a particular vertex in the graph.
 
Methods inherited from class ls.Graph
addEdge, addVertex, addVertex, findEdges, getEdge, getEdges, getVertex, getVertices, numEdges, numVertices, print, printAddress, setEdges, setVertices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectedGraph

public DirectedGraph()
Creates a new directed graph.
Method Detail

addEdge

public void addEdge(java.lang.Object parent,
                    java.lang.Object child)
Adds a directed edge to the graph.
Overrides:
addEdge in class Graph
Parameters:
parent - - the parent of the edge
child - - the child of the edge

addEdge

public void addEdge(Vertex parent,
                    Vertex child)
Adds a directed edge between two vertices to the graph.
Overrides:
addEdge in class Graph
Parameters:
parent - - the parent of the edge
chlid - - the child of the edge

existsEdge

public boolean existsEdge(Edge e)
Checks to see of an edges exists in this graph. This is used to avoid duplicate edges in the graph.
Overrides:
existsEdge in class Graph
Parameters:
e - the edge that is being looked for

getParents

public java.util.Vector getParents(Vertex v)
Returns all of the parents associated with a particular vertex in the graph.
Parameters:
v - the vertex that we are looking for parents of

getChildren

public java.util.Vector getChildren(Vertex v)
Returns all the children of a particular vertex in the graph.
Parameters:
v - the vertex that we are looking for its children