harpoon.Util.Collections
Class AbstractGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

java.lang.Object
  extended by harpoon.Util.Collections.AbstractGraph<N,E>
All Implemented Interfaces:
Graph<N,E>, MutableGraph<N,E>
Direct Known Subclasses:
QuadFlowGraph

public abstract class AbstractGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>
extends Object
implements MutableGraph<N,E>

An AbstractGraph provides a basic implementation of the Graph interface.

Version:
$Id: AbstractGraph.java,v 1.3 2004/02/08 03:21:44 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Nested Class Summary
static class AbstractGraph.Edge<N extends AbstractGraph.Node<N,E>,E extends AbstractGraph.Edge<N,E>>
          AbstractGraph.Edge provides a basic implementation of the Graph.Edge interface.
static class AbstractGraph.Node<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>
          AbstractGraph.Node provides a basic implementation of the Graph.Node interface.
 
Constructor Summary
protected AbstractGraph()
           
 
Method Summary
protected  void addEdge(E e)
           
abstract  E addEdge(N from, N to)
          Add an edge from from to to and return the new edge.
 void addNode(N n)
          Add a new node to the graph.
 Set<N> nodes()
          Return the set of nodes comprising this Graph.
 void removeEdge(E e)
          Remove the given edge from the graph.
 void summarize(Collection<N> nodesToRemove)
          Remove all specified nodes, preserving path information.
 void summarize(N nodeToRemove)
          Remove the given node, preserving edges: if A->N->B, then after removing N there is an edge A->B.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGraph

protected AbstractGraph()
Method Detail

nodes

public Set<N> nodes()
Description copied from interface: Graph
Return the set of nodes comprising this Graph.

Specified by:
nodes in interface Graph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

summarize

public void summarize(Collection<N> nodesToRemove)
Description copied from interface: MutableGraph
Remove all specified nodes, preserving path information.

Specified by:
summarize in interface MutableGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

summarize

public void summarize(N nodeToRemove)
Description copied from interface: MutableGraph
Remove the given node, preserving edges: if A->N->B, then after removing N there is an edge A->B.

Specified by:
summarize in interface MutableGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

addEdge

public abstract E addEdge(N from,
                          N to)
Description copied from interface: MutableGraph
Add an edge from from to to and return the new edge.

Specified by:
addEdge in interface MutableGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

addNode

public void addNode(N n)
Description copied from interface: MutableGraph
Add a new node to the graph.

Specified by:
addNode in interface MutableGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>

addEdge

protected void addEdge(E e)

removeEdge

public void removeEdge(E e)
Description copied from interface: MutableGraph
Remove the given edge from the graph.

Specified by:
removeEdge in interface MutableGraph<N extends AbstractGraph.Node<N,E>,E extends Graph.Edge<N,E>>