|
||||||||||
| 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
|
+--edu.stanford.multiagent.gamer.graphs.ALGraph
An Adjacency list implementation of the Graph interface.
| Field Summary | |
protected java.util.Vector |
nodes
|
| 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 | |
ALGraph()
Constructor |
|
ALGraph(int nNodes)
Constructor which initializes the number of nodes. |
|
| Method Summary | |
void |
addEdge(int s,
int t)
Add a new edge to the graph. |
void |
addEdge(int s,
int t,
java.lang.Object data)
Add an edge with data to the graph. |
void |
addNode()
Adds a new node to the graph. |
boolean |
areNeighbours(int from,
int to)
Checks if two nodes are neighbours in the graph. |
protected void |
checkParameters()
May be implemented by subclasses to check parameters if any exist. |
edu.stanford.multiagent.gamer.graphs.Edge |
getEdge(int s,
int t)
Returns an Edge object from the graph. |
java.util.Iterator |
getEdges(int from)
Returns an iterator over the outgoing edges from a node. |
java.util.Iterator |
getNeighbours(int from)
Returns an iterator over the node's neighbours. |
int |
getNumNeighbours(int from)
Return number of neighbours extending from a node. |
void |
removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
Removes an edge from the graph. |
void |
removeEdge(int s,
int t)
Removes an edge from the graph. |
void |
setEdgeData(int s,
int t,
java.lang.Object data)
Sets the data item for a preexisting edge. |
| 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 |
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 java.util.Vector nodes
| Constructor Detail |
public ALGraph()
throws java.lang.Exception
public ALGraph(int nNodes)
throws java.lang.Exception
nNodes - the number of nodes in the graph| Method Detail |
public void addNode()
addNode in class Graph
public void addEdge(int s,
int t)
addEdge in class Graphs - the index of the node where the edge should startt - the index of the node where the edge should end
public void addEdge(int s,
int t,
java.lang.Object data)
addEdge in class Graphs - the index of the node where the edge should startt - the index of the node where the graph should enddata - the data which is to be stored at the edge
public void setEdgeData(int s,
int t,
java.lang.Object data)
setEdgeData in class Graphs - the index of the node where the edge beginst - the index of the node where the edge endsdata - the data which is to be stored at the edge
public void removeEdge(int s,
int t)
removeEdge in class Graphs - the index of the node where the edge beginst - the index of the node where the edge endspublic void removeEdge(edu.stanford.multiagent.gamer.graphs.Edge e)
removeEdge in class Graphe - the edge to be removed
public edu.stanford.multiagent.gamer.graphs.Edge getEdge(int s,
int t)
getEdge in class Graphs - the index of the node where the edge beginst - the index of the node where the edge ends
public boolean areNeighbours(int from,
int to)
areNeighbours in class Graphfrom - the index of the node where the edge beginsto - the index of the node where the edge endspublic java.util.Iterator getNeighbours(int from)
getNeighbours in class Graphfrom - the index of the node whose neighbours should
be returnedpublic java.util.Iterator getEdges(int from)
getEdges in class Graphfrom - the index of the node whose neighbours should
be returnedpublic int getNumNeighbours(int from)
from - the index of the node
protected void checkParameters()
throws java.lang.Exception
checkParameters in class ParameterizedObjectjava.lang.Exception - if anything is wrong with the parameter
values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||