edu.stanford.multiagent.gamer.graphs
Class AMGraph

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.ParameterizedObject
        |
        +--edu.stanford.multiagent.gamer.graphs.Graph
              |
              +--edu.stanford.multiagent.gamer.graphs.AMGraph

public abstract class AMGraph
extends Graph

An Adjacency matrix implementation of the Graph interface Not fully implemented.


Field Summary
 
Fields inherited from class edu.stanford.multiagent.gamer.graphs.Graph
nEdges, nNodes, nodeData, pReflexEdges, pSymEdges
 
Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject
parameters
 
Constructor Summary
AMGraph()
          Constructor
AMGraph(int nNodes)
          Constructor, initializes the number of nodes
 
Method Summary
 void addEdge(int s, int t)
          Adds an edge.
 void addEdge(int s, int t, java.lang.Object data)
          Add an edge with data Currently not implemented, does the same thing as the other version of addEdge.
 void addNode()
          Adds a node.
 boolean areNeighbours(int from, int to)
          Checks if two nodes are neighbours.
 edu.stanford.multiagent.gamer.graphs.Edge getEdge(int s, int t)
          Gets an Edge
 java.util.Iterator getEdges(int from)
          Return an iterator over the outgoing edges
 java.util.Iterator getNeighbours(int from)
          Returns an iterator over the node's neighbours
 void removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
          Removes an edge from the graph.
 void removeEdge(int s, int t)
          Removes an edge
 void setEdgeData(int s, int t, java.lang.Object data)
          Sets the data item for the edge between s and t if this edge already exists
 
Methods inherited from class edu.stanford.multiagent.gamer.graphs.Graph
getGraphHelp, getHelp, getNEdges, getNNodes, getNodeData, hasSymEdges, initialize, reflexEdgesOk, setNodeData
 
Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject
checkParameters, doGenerate, getBooleanParameter, getDescription, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, randomizeParameters, setParameter, setParameter, setParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMGraph

public AMGraph()
        throws java.lang.Exception
Constructor


AMGraph

public AMGraph(int nNodes)
        throws java.lang.Exception
Constructor, initializes the number of nodes

Method Detail

addNode

public void addNode()
Adds a node.

Specified by:
addNode in class Graph

addEdge

public void addEdge(int s,
                    int t)
Adds an edge.

Specified by:
addEdge in class Graph
Parameters:
s - index of first node
t - index of second node

addEdge

public void addEdge(int s,
                    int t,
                    java.lang.Object data)
Add an edge with data Currently not implemented, does the same thing as the other version of addEdge.

Specified by:
addEdge in class Graph
Parameters:
s - index of first node
t - index of second node
data - data to be stored on this edge

setEdgeData

public void setEdgeData(int s,
                        int t,
                        java.lang.Object data)
Sets the data item for the edge between s and t if this edge already exists

Specified by:
setEdgeData in class Graph
Parameters:
s - index of the first node on the edge
t - index of the second node on the egde
data - data to be stored on the edge

removeEdge

public void removeEdge(int s,
                       int t)
Removes an edge

Specified by:
removeEdge in class Graph
Parameters:
s - index of the first node on the edge
t - index of the second node on the edge

removeEdge

public void removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
Description copied from class: Graph
Removes an edge from the graph.

Specified by:
removeEdge in class Graph
Parameters:
e - the edge to be removed

getEdge

public edu.stanford.multiagent.gamer.graphs.Edge getEdge(int s,
                                                         int t)
Gets an Edge

Specified by:
getEdge in class Graph
Parameters:
s - index of the first node on the edge
t - index of the second node on the edge

areNeighbours

public boolean areNeighbours(int from,
                             int to)
Checks if two nodes are neighbours. This check is directional.

Specified by:
areNeighbours in class Graph
Parameters:
from - index of the node at which the edge begins
to - index of the node at which the egde ends

getNeighbours

public java.util.Iterator getNeighbours(int from)
Returns an iterator over the node's neighbours

Specified by:
getNeighbours in class Graph
Parameters:
from - index of the node

getEdges

public java.util.Iterator getEdges(int from)
Return an iterator over the outgoing edges

Specified by:
getEdges in class Graph
Parameters:
from - index of the node