|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.stanford.multiagent.gamer.ParameterizedObject
|
+--edu.stanford.multiagent.gamer.graphs.Graph
An abstract base class for graph implementations. Note that currently nodes are assumed to be consecutive, starting at 0, and that this class must be updated, if node removal is desired.
| Field Summary | |
protected int |
nEdges
|
protected int |
nNodes
|
protected java.util.HashMap |
nodeData
|
protected static Parameters.ParamInfo |
pReflexEdges
|
protected static Parameters.ParamInfo |
pSymEdges
|
| Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
parameters |
| Constructor Summary | |
protected |
Graph()
Constructor. |
| Method Summary | |
abstract void |
addEdge(int s,
int t)
Adds a new edge to the graph between nodes s and t. |
abstract void |
addEdge(int s,
int t,
java.lang.Object data)
Adds a new edge to the graph between nodes s and t and sets the edge data for this edge. |
abstract void |
addNode()
Adds a new node to the graph. |
abstract boolean |
areNeighbours(int from,
int to)
Checks if two nodes are neighbours, i.e. |
abstract edu.stanford.multiagent.gamer.graphs.Edge |
getEdge(int s,
int t)
Gets an Edge. |
abstract java.util.Iterator |
getEdges(int from)
Returns an iterator over the outgoing edges from a node. |
protected abstract java.lang.String |
getGraphHelp()
Returns a help information string about the particular graph, does not include parameter information. |
java.lang.String |
getHelp()
Returns the help string with information about the graph class and the parameters taken by the class. |
int |
getNEdges()
Returns the number of edges in the graph. |
abstract java.util.Iterator |
getNeighbours(int from)
Returns an iterator over a node's neighbours. |
int |
getNNodes()
Returns the number of vertices in the graph. |
java.lang.Object |
getNodeData(int n)
Returns any data that is being stored at a node. |
abstract boolean |
hasSymEdges()
Returns true if the graph is symmetric, i.e. |
void |
initialize()
Initializes the graph structure using preset parameter values. |
abstract boolean |
reflexEdgesOk()
Returns true if reflexive edges are allowed in the graph. |
abstract void |
removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
Removes an edge from the graph. |
abstract void |
removeEdge(int s,
int t)
Removes an edge from the graph. |
abstract void |
setEdgeData(int s,
int t,
java.lang.Object data)
Sets the edge data for an already existing edge. |
void |
setNodeData(int n,
java.lang.Object data)
Sets node data. |
| 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 |
| Field Detail |
protected int nEdges
protected int nNodes
protected java.util.HashMap nodeData
protected static Parameters.ParamInfo pSymEdges
protected static Parameters.ParamInfo pReflexEdges
| Constructor Detail |
protected Graph()
throws java.lang.Exception
| Method Detail |
public void initialize()
throws java.lang.Exception
initialize in class ParameterizedObjectjava.lang.Exceptionpublic java.lang.String getHelp()
getHelp in class ParameterizedObjectprotected abstract java.lang.String getGraphHelp()
public int getNEdges()
public int getNNodes()
public java.lang.Object getNodeData(int n)
n - the index of the node
public void setNodeData(int n,
java.lang.Object data)
n - the index of the nodedata - the data to be stored at the nodepublic abstract void addNode()
public abstract void addEdge(int s,
int t)
s - index of first nodet - index of second node
public abstract void addEdge(int s,
int t,
java.lang.Object data)
s - index of first nodet - index of second nodedata - data to be stored on this edge
public abstract void setEdgeData(int s,
int t,
java.lang.Object data)
s - index of the first node on the edget - index of the second node on the egdedata - data to be stored on the edge
public abstract void removeEdge(int s,
int t)
s - index of the first node on the edget - index of the second node on the edgepublic abstract void removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
e - the edge to be removed
public abstract edu.stanford.multiagent.gamer.graphs.Edge getEdge(int s,
int t)
s - index of the first node on the edget - index of the second node on the edge
public abstract boolean areNeighbours(int from,
int to)
from - index of the node at which the edge beginsto - index of the node at which the egde endspublic abstract java.util.Iterator getNeighbours(int from)
from - index of the nodepublic abstract java.util.Iterator getEdges(int from)
from - index of the nodepublic abstract boolean hasSymEdges()
public abstract boolean reflexEdgesOk()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||