net.walend.digraph
Interface CEDigraph

All Superinterfaces:
Digraph, HasState
All Known Subinterfaces:
CEPath, DigraphOfCEPaths, DigraphOfGEPaths, IndexedCEDigraph, IndexedMutableCEDigraph, MeasuredCEPath, MutableCEDigraph, MutableCEPath, MutableDigraphOfCEPaths, MutableDigraphOfGEPaths, ShortestCEPaths, ShortestGEPaths
All Known Implementing Classes:
AbstractDelegateDigraphOfCEPaths, AbstractDelegateDigraphOfCEPaths.DigraphCEPath, AbstractDelegateDigraphOfGEPaths, AbstractHashCEDigraph, AbstractListCEPath, AbstractMatrixCEDigraph, AbstractShortestCEPaths, AbstractShortestCEPaths.DigraphMeasuredCEPath, AbstractShortestGEPaths, CEBellmanFordTest, CEBellmanFordTest.BFCEDigraph, CEPathsFromShortestDistances, CEPathsFromShortestDistances.DigraphMeasuredCEPath, DijkstraShortestCEPaths, DijkstraShortestGEPaths, FloydWarshallShortestCEPaths, FloydWarshallShortestGEPaths, GEBellmanFordTest, JITShortestCEPaths, JITShortestGEPaths, JohnsonShortestCEPaths, JohnsonShortestGEPaths, MutableHashCEDigraph, MutableListCEPath, MutableLMCEDigraph, MutableMatrixCEDigraph

public interface CEDigraph
extends Digraph

CEDigraph is an interface for representing directed graphs of nodes linked by zero or one edge. Each node and edge must be a unique Object in the digraph. Reusing edges and nodes may produce unpredictable results.

By default, this digraph uses equals() as the method to determine identity.

One could create a subclass of CEDigraph that will work with zero or more edges by extending this interface. I have not done that.

Direct implementations of CEDigraph should have a single constructor that takes a CEDigraph as a parameter. Some implementations should provide a view of this CEDigraph, by implementing the net.walend.collection.View interface. Others should copy the parameter to produced an immutable CEDigraph.

Since:
20010612
Author:
David Walend dfw1@cornell.edu

Field Summary
static CEDigraph EMPTY
           
 
Method Summary
 boolean containsCEDigraph(CEDigraph digraph)
          Returns true if digraph is a subgraph of this CEDigraph.
 boolean containsEdge(java.lang.Object fromNode, java.lang.Object toNode, java.lang.Object edge)
          Returns true if edge links fromNode to toNode
 EdgeIterator edgeIterator()
           
 java.lang.Object getEdge(java.lang.Object fromNode, java.lang.Object toNode)
          Returns null if no edge links fromNode to toNode
 Bag getEdges()
           
 Bag getInboundEdges(java.lang.Object node)
          Returns the empty set if node has no inbound edges.
 Bag getOutboundEdges(java.lang.Object node)
          Returns the empty set if node has no outbound edges.
 CEDigraph intersectWithCEDigraph(CEDigraph digraph)
          Returns a new digraph that is the intersection of this with digraph.
 boolean sameCEDigraphAs(CEDigraph digraph)
          Returns true if digraph is the same as this; that is, if this.containsCEDigraph(digraph) and digraph.containsCEDigraph(this).
 CEDigraph unionCEDigraph(CEDigraph digraph)
          Returns a new digraph that is the union of this with digraph.
 
Methods inherited from interface net.walend.digraph.Digraph
containsEdge, containsNode, containsNodes, countInboundEdges, countOutboundEdges, edgeCount, edgeNodeIterator, getFromNodes, getNodes, getToNodes, isEdgeFree, isEmpty, nodeCount, nodeIterator
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Field Detail

EMPTY

public static final CEDigraph EMPTY
Method Detail

containsEdge

public boolean containsEdge(java.lang.Object fromNode,
                            java.lang.Object toNode,
                            java.lang.Object edge)
                     throws NodeMissingException
Returns true if edge links fromNode to toNode

Throws:
NodeMissingException - if either node is missing from the digraph.

getEdges

public Bag getEdges()

getInboundEdges

public Bag getInboundEdges(java.lang.Object node)
                    throws NodeMissingException
Returns the empty set if node has no inbound edges.

Throws:
NodeMissingException - if node is not in the digraph.

getOutboundEdges

public Bag getOutboundEdges(java.lang.Object node)
                     throws NodeMissingException
Returns the empty set if node has no outbound edges.

Throws:
NodeMissingException - if node is not in the digraph.

getEdge

public java.lang.Object getEdge(java.lang.Object fromNode,
                                java.lang.Object toNode)
                         throws NodeMissingException
Returns null if no edge links fromNode to toNode

Throws:
NodeMissingException - if either node is missing from the digraph.

edgeIterator

public EdgeIterator edgeIterator()

containsCEDigraph

public boolean containsCEDigraph(CEDigraph digraph)
Returns true if digraph is a subgraph of this CEDigraph.


sameCEDigraphAs

public boolean sameCEDigraphAs(CEDigraph digraph)
Returns true if digraph is the same as this; that is, if this.containsCEDigraph(digraph) and digraph.containsCEDigraph(this).


intersectWithCEDigraph

public CEDigraph intersectWithCEDigraph(CEDigraph digraph)
Returns a new digraph that is the intersection of this with digraph. Implementations should generally return the same implementation of CEDigraph as they have themselves.


unionCEDigraph

public CEDigraph unionCEDigraph(CEDigraph digraph)
Returns a new digraph that is the union of this with digraph. Implementations should generally return the same implementation of CEDigraph as they are themselves. If the digraphs contain conflicting edges, then (unless you have a better rule) let digraph's edge win out.



Copyright (c) 2001, 2002, David Walend