uchicago.src.sim.topology.graph
Interface Graph

All Superinterfaces:
ModifyableTopology, RelationTopology, java.io.Serializable
All Known Implementing Classes:
AbstractGraph

public interface Graph
extends ModifyableTopology, java.io.Serializable

This represents a more specific RelationTopology, where relationships are represented by edges. This provides support for directed or non-directed edges. While this does imply a particular implementation approach for concrete implementations, the primary goal of this was to semantically represent a collection of relationships which adhere to a graph structure, such as a Social Network, not to impose any syntactic implementation requirements.

Version:
$Revision: 1.8 $
Author:
Tom Howe

Method Summary
 boolean areAdjacent(java.lang.Object v, java.lang.Object v1, EdgeType type)
          Returns whether the two elements share an edge with the given directionality.
 int degree(java.lang.Object v, EdgeType type)
          Returns the number of edges for the object with the given directionality.
 java.util.List getAdjacentNodes(java.lang.Object v, double distance, EdgeType type)
           
 java.util.List getAdjacentNodes(java.lang.Object v, EdgeType type)
          Get the Nodes that share an edge with the parameter with the proper directionality.
 java.util.List getEdges(java.lang.Object v, EdgeType type)
          Returns the edge objects of the given directionality for the object.
 java.util.Set getNodes()
           
 void insertEdge(Edge e)
          Insert an edge that has already been created.
 void insertEdge(java.lang.Object e, java.lang.Object e1, double strength)
          Insert a new edge into the graph.
 java.util.Iterator iterator()
          Get an iterator for the graph.
 void removeEdge(Edge e)
          Removes an edge from the graph.
 void removeEdge(java.lang.Object e, java.lang.Object e1)
           
 int size()
           
 
Methods inherited from interface uchicago.src.sim.topology.ModifyableTopology
addRelation, removeRelation
 
Methods inherited from interface uchicago.src.sim.topology.RelationTopology
distance, getRelations, getRelationType, setRelationType
 

Method Detail

insertEdge

public void insertEdge(java.lang.Object e,
                       java.lang.Object e1,
                       double strength)
Insert a new edge into the graph. This method will create a new edge based on the class specification from the edgeClass parameter.

Parameters:
e -
e1 -

insertEdge

public void insertEdge(Edge e)
Insert an edge that has already been created.

Parameters:
e -

removeEdge

public void removeEdge(Edge e)
Removes an edge from the graph. This should also remove the edge from the elements of the edge. In other words, after this call, there should be no references to the edge.

Parameters:
e -

removeEdge

public void removeEdge(java.lang.Object e,
                       java.lang.Object e1)
Parameters:
e -
e1 -

getAdjacentNodes

public java.util.List getAdjacentNodes(java.lang.Object v,
                                       EdgeType type)
Get the Nodes that share an edge with the parameter with the proper directionality.

Parameters:
v -
type -
Returns:

getAdjacentNodes

public java.util.List getAdjacentNodes(java.lang.Object v,
                                       double distance,
                                       EdgeType type)
Parameters:
v -
distance -
type -
Returns:

areAdjacent

public boolean areAdjacent(java.lang.Object v,
                           java.lang.Object v1,
                           EdgeType type)
Returns whether the two elements share an edge with the given directionality.

Parameters:
v -
v1 -
type -
Returns:

getEdges

public java.util.List getEdges(java.lang.Object v,
                               EdgeType type)
Returns the edge objects of the given directionality for the object.

Parameters:
v -
type -
Returns:

degree

public int degree(java.lang.Object v,
                  EdgeType type)
Returns the number of edges for the object with the given directionality.

Parameters:
v -
type -
Returns:

iterator

public java.util.Iterator iterator()
Get an iterator for the graph.

Returns:

size

public int size()

getNodes

public java.util.Set getNodes()