JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.graph
Class VertexAndEdgeProvider

java.lang.Object
  extended bygov.nasa.javaGenes.graph.VertexAndEdgeProvider
All Implemented Interfaces:
java.io.Serializable

public class VertexAndEdgeProvider
extends java.lang.Object
implements java.io.Serializable

holds a set of vertices and a set of edges. Vertices and edges should not be connected to anything. Provides copies of these at random when asked. Used to generate random graphs. Vertices and edges are provided with equal probability. To skew the distribution add extra copies of what you want more of.

See Also:
Graph, Serialized Form

Field Summary
protected  ExtendedVector edges
          the edges to be provided
protected  ExtendedVector vertices
          the vertices to be provided.
 
Constructor Summary
VertexAndEdgeProvider()
           
 
Method Summary
 void add(Edge e)
          add e to the edges to be provided
 void add(Vertex v)
          add v to the vertices to be provided
 DirectedEdge getDirectedEdge()
           
 DirectedEdge getDirectedEdge(Predicate p)
           
 DirectedVertex getDirectedVertex()
           
 DirectedVertex getDirectedVertex(Predicate p)
           
 Edge getEdge()
           
 Edge getEdge(Predicate p)
           
 Vertex getVertex()
           
 Vertex getVertex(Predicate p)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vertices

protected ExtendedVector vertices
the vertices to be provided.


edges

protected ExtendedVector edges
the edges to be provided

Constructor Detail

VertexAndEdgeProvider

public VertexAndEdgeProvider()
Method Detail

add

public void add(Vertex v)
add v to the vertices to be provided


getVertex

public Vertex getVertex()
Returns:
a copy of a random vertex

getDirectedVertex

public DirectedVertex getDirectedVertex()

getVertex

public Vertex getVertex(Predicate p)
Returns:
a copy of a random vertex that satisfies p

getDirectedVertex

public DirectedVertex getDirectedVertex(Predicate p)

add

public void add(Edge e)
add e to the edges to be provided


getEdge

public Edge getEdge()
Returns:
a copy of a random edge

getDirectedEdge

public DirectedEdge getDirectedEdge()
Returns:
a copy of a random edge

getEdge

public Edge getEdge(Predicate p)
Returns:
a copy of a random edge that satisfies p

getDirectedEdge

public DirectedEdge getDirectedEdge(Predicate p)
Returns:
a copy of a random edge that satisfies p

toString

public java.lang.String toString()

JavaGenes, NASA Ames. Written largely by Al Globus