structure
Class GraphListDirected

java.lang.Object
  extended by structure.AbstractStructure
      extended by structure.GraphList
          extended by structure.GraphListDirected
All Implemented Interfaces:
Graph, Structure

public class GraphListDirected
extends GraphList

A class implementing a directed, adjacency-list based graph.

See Also:
GraphList, GraphListUndirected, GraphMatrixDirected

Constructor Summary
GraphListDirected()
          Construct a directed, adjacency-list based graph.
 
Method Summary
 void addEdge(Object vLabel1, Object vLabel2, Object label)
          Add an edge between two vertices within the graph.
 int edgeCount()
          Determine the number of edges in graph.
 Object remove(Object label)
          Remove a vertex from the graph.
 Object removeEdge(Object vLabel1, Object vLabel2)
          Remove possible edge between vertices labeled vLabel1 and vLabel2.
 String toString()
          Construct a string representation of graph.
 
Methods inherited from class structure.GraphList
add, clear, contains, containsEdge, degree, edges, get, getEdge, isDirected, isEmpty, isVisited, isVisitedEdge, iterator, neighbors, reset, size, visit, visitEdge
 
Methods inherited from class structure.AbstractStructure
elements, hashCode, values
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface structure.Structure
elements, values
 

Constructor Detail

GraphListDirected

public GraphListDirected()
Construct a directed, adjacency-list based graph.

Method Detail

addEdge

public void addEdge(Object vLabel1,
                    Object vLabel2,
                    Object label)
Add an edge between two vertices within the graph. Edge is directed. Duplicate edges are silently replaced. Labels on edges may be null.

Specified by:
addEdge in interface Graph
Specified by:
addEdge in class GraphList
Parameters:
vLabel1 - Source vertex.
vLabel2 - Destination vertex.
label - Label associated with the edge.

remove

public Object remove(Object label)
Remove a vertex from the graph. Associated edges are also removed. Non-vertices are silently ignored.

Specified by:
remove in interface Graph
Specified by:
remove in interface Structure
Specified by:
remove in class GraphList
Parameters:
label - The label of the vertex within the graph.
Returns:
The label associated with the vertex.

removeEdge

public Object removeEdge(Object vLabel1,
                         Object vLabel2)
Remove possible edge between vertices labeled vLabel1 and vLabel2. vLabel1 is the source.

Specified by:
removeEdge in interface Graph
Specified by:
removeEdge in class GraphList
Parameters:
vLabel1 - Source vertex.
vLabel2 - Destination vertex.
Returns:
The label associated with the edge removed.

edgeCount

public int edgeCount()
Determine the number of edges in graph.

Specified by:
edgeCount in interface Graph
Specified by:
edgeCount in class GraphList
Returns:
Number of edges in graph.

toString

public String toString()
Construct a string representation of graph.

Overrides:
toString in class Object
Returns:
String representing graph.