drasys.or.graph
Interface GraphI

All Known Subinterfaces:
AddEdgeI, AddI, AddVertexI, EditI, RemoveEdgeI, RemoveI, RemoveVertexI
All Known Implementing Classes:
Graph, MatrixGraph, PointGraph

public interface GraphI

The interface used by all algorithms to access graphs abstractly.

See Also:
Graph, DenseGraph, SparseGraph, PointGraph, MatrixGraph

Method Summary
 java.util.Enumeration edges()
          Creates an enumeration on the edges of the graph.
 int getChangeCount()
          Returns the number of changes that have been made to a graph.
 EdgeI getEdge(EdgeI edge)
          Get an edge using the keys in the 'edge' argument.
 EdgeI getEdge(java.lang.Object fromKey, java.lang.Object toKey, java.lang.Object edgeKey)
          Get the edge between the from and to vertices whose key matches 'edgeKey'.
 EdgeI getEdge(VertexI from, VertexI to, java.lang.Object key)
          Get the edge between the from and to vertices whose key matches 'edgeKey'.
 EdgeI getMutableEdge(VertexI from, VertexI to, java.lang.Object edgeKey)
          Get the edge between the from and to vertices whose key matches 'edgeKey'.
 VertexI getVertex(java.lang.Object key)
          Get the vertex that matches the key.
 boolean isSubsetOf(GraphI graph)
          A graph is a subset of another if all its elements are contained in the other.
 boolean isSymmetric()
          Returns either the forced value from 'setSymmetric' or the graph's automatically determined symmetry.
 java.util.Enumeration mutableEdges()
          Creates an enumeration on the edges of the graph.
 void setSymmetric(java.lang.Boolean symmetric)
          Forces algorithms to treat the graph as either symmetric or asymetric.
 int sizeOfDirectedEdges()
           
 int sizeOfEdges()
           
 int sizeOfVertices()
           
 java.util.Enumeration vertices()
          Creates an enumeration on the vertices of the graph.
 

Method Detail

setSymmetric

public void setSymmetric(java.lang.Boolean symmetric)
Forces algorithms to treat the graph as either symmetric or asymetric. An argument of 'null' causes the graph to automatically determine the return value for 'isSymmetric()'.

isSymmetric

public boolean isSymmetric()
Returns either the forced value from 'setSymmetric' or the graph's automatically determined symmetry.

getChangeCount

public int getChangeCount()
Returns the number of changes that have been made to a graph. This can be used by algorithms to determine is a graph has changed since initialization.

sizeOfVertices

public int sizeOfVertices()
Returns:
The number vertices in the graph.

vertices

public java.util.Enumeration vertices()
Creates an enumeration on the vertices of the graph.
Returns:
An enumeration with elements of class VertexI.

getVertex

public VertexI getVertex(java.lang.Object key)
Get the vertex that matches the key.
Returns:
Null if the vertex is not in the graph.

sizeOfEdges

public int sizeOfEdges()
Returns:
The number edges in the graph.

sizeOfDirectedEdges

public int sizeOfDirectedEdges()
Returns:
The number of directed edges in the graph.

edges

public java.util.Enumeration edges()
Creates an enumeration on the edges of the graph. The returned edges will be immutable.
Returns:
An enumeration with elements of class EdgeI.

mutableEdges

public java.util.Enumeration mutableEdges()
Creates an enumeration on the edges of the graph. The enumeration is allowed to return mutable edges if that is more efficient, but the contents of an edge must be used before 'nextElement()' is called again.
Returns:
An enumeration with elements of class EdgeI.

getEdge

public EdgeI getEdge(EdgeI edge)
Get an edge using the keys in the 'edge' argument.
Returns:
Null if the edge is not in the graph.

getEdge

public EdgeI getEdge(java.lang.Object fromKey,
                     java.lang.Object toKey,
                     java.lang.Object edgeKey)
Get the edge between the from and to vertices whose key matches 'edgeKey'.
Returns:
Null if the edge is not in the graph.

getMutableEdge

public EdgeI getMutableEdge(VertexI from,
                            VertexI to,
                            java.lang.Object edgeKey)
Get the edge between the from and to vertices whose key matches 'edgeKey'. The graph is allowed to return a mutable edge if that is more efficient, but the edge contents must be used before 'getMutableEdge()' is called again.
Returns:
Null if the edge is not in the graph.

getEdge

public EdgeI getEdge(VertexI from,
                     VertexI to,
                     java.lang.Object key)
Get the edge between the from and to vertices whose key matches 'edgeKey'. The arguments 'from' and 'to' must be vertices from this graph.
Returns:
Null if the edge is not in the graph.

isSubsetOf

public boolean isSubsetOf(GraphI graph)
A graph is a subset of another if all its elements are contained in the other.
Returns:
True if this graph is a subset of the argument.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com