|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectbeowulf.model.graph.AbstractGraphModel
beowulf.model.graph.UndirectedGraph
This class is a model of a Graph. It consists of collections of nodes
and edges, each of which have their own analogous classes. The class is
optimized for speed, not for space. Much of the data is stored in
multiple ways so that it will be quickly accessible. One can add nodes
and edges arbitrarily. Edges of course must start at one node and end
at another. An edge from node A to node B is different than one from
node B to node A. Edges between nodes can be accessed in collections of
1) Those going to a particular node
2) Those going from a particular node
3) All Edges
| Field Summary | |
protected Vector |
edgeList
A vector of all of the edges. |
protected Vector |
nodeList
The vector containing all of the nodes. |
protected VectorMatrix |
transitionMatrix
A matrix in that holds transitions between nodes. |
protected Vector |
usedIndices
Holds a list of used indices for identifying a particular node. |
protected boolean |
useDotEquals
Holds a flag that tells this object whether to use .equals for object comparison, or ==. |
protected Map |
valueToIndex
Translates a nodes contents into an identifying number. |
| Fields inherited from class beowulf.model.graph.AbstractGraphModel |
listenerList |
| Constructor Summary | |
UndirectedGraph()
Basic constructor for a Graph. |
|
UndirectedGraph(boolean newUseDotEquals)
This constructor lets the user choose whether reference equality (==) or semantic equality (.equals()) will be used in differentiating between nodes in a graph. |
|
| Method Summary | |
void |
addEdge(Edge edge)
This method will add a new edge to the graph. |
void |
addEdge(Object sourceValue,
Object destinationValue,
Object cost)
This method will add a new edge to the graph. |
void |
addNode(Object value)
This method adds a new node to the graph, and associates the parameter as the value of the node. |
int |
getEdgeCount()
Returns the number of edges in the graph. |
Vector |
getEdges()
Returns a list of all edges in the graph. |
Vector |
getEdgesFrom(Object value)
Given the value of some node, this method will return a list of all edges originating at this node. |
Vector |
getEdgesFromTo(Object sourceValue,
Object destValue)
Given the value of the source node and the destination node, this method will return a list of all edges going between the two nodes. |
Vector |
getEdgesTo(Object value)
Given the value of some node, this method will return a list of all edges ending at this node. |
int |
getNodeCount()
Returns the number of nodes in the graph. |
Vector |
getNodes()
Returns a list of the values of each node in the graph. |
boolean |
getUseDotEquals()
Returns true if this graph instance uses .equals for object comparison. |
boolean |
isDirected()
Returns whether or not the graph is directed. |
boolean |
isSimple()
Returns whether or not the graph is simple (ie - there are no edges from some node to itself and there is at most one edge between any two different nodes). |
Object |
removeEdge(Edge toRemove)
This method will remove the edge from the graph. |
Object |
removeEdge(Object sourceValue,
Object destinationValue,
Object cost)
This method will remove the edge with the indicated source and destination values from the graph. |
void |
removeNode(Object value)
Given a node's value, this method will find and remove that node, and any associated edges from the graph. |
String |
toString()
Returns a basic string representation of this graph. |
String |
toString(boolean fullThing)
This method is implemented simply to keep with the possibility of a verbose representation of a Graph. |
| Methods inherited from class beowulf.model.graph.AbstractGraphModel |
addGraphListener, fireEdgeAdded, fireEdgeRemoved, fireNodeAdded, fireNodeRemoved, getGraphListeners, getListeners, removeGraphListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected VectorMatrix transitionMatrix
protected Vector nodeList
protected Vector edgeList
protected Map valueToIndex
protected Vector usedIndices
protected boolean useDotEquals
| Constructor Detail |
public UndirectedGraph()
public UndirectedGraph(boolean newUseDotEquals)
newUseDotEquals - True if this graph should use .equals.| Method Detail |
public boolean getUseDotEquals()
getUseDotEquals in interface GraphModelpublic Vector getNodes()
getNodes in interface GraphModelpublic Vector getEdges()
getEdges in interface GraphModelpublic int getNodeCount()
getNodeCount in interface GraphModelpublic int getEdgeCount()
getEdgeCount in interface GraphModelpublic boolean isDirected()
isDirected in interface GraphModelpublic boolean isSimple()
isSimple in interface GraphModel
public Vector getEdgesFromTo(Object sourceValue,
Object destValue)
getEdgesFromTo in interface GraphModelsourceValue - The value of the source node.destValue - The value of the destination node.
public Vector getEdgesFrom(Object value)
getEdgesFrom in interface GraphModelvalue - The value of some node in the graph.
public Vector getEdgesTo(Object value)
getEdgesTo in interface GraphModelvalue - The value of some node in the graph.
public void removeNode(Object value)
removeNode in class AbstractGraphModelvalue - The value of the node to be removed.public void addNode(Object value)
addNode in class AbstractGraphModelvalue - The value of the node to be added.public Object removeEdge(Edge toRemove)
removeEdge in class AbstractGraphModeltoRemove - The edge to be removed.
public Object removeEdge(Object sourceValue,
Object destinationValue,
Object cost)
removeEdge in class AbstractGraphModelsourceValue - The value of the source node of the edge.destinationValue - The value of the destination node of the edge.cost - The cost of the edge to be removed.
public void addEdge(Object sourceValue,
Object destinationValue,
Object cost)
addEdge in class AbstractGraphModelsourceValue - The value of the source node of the new edge.destinationValue - The value of the destination node of the new
edge.cost - The cost of the new edge.public void addEdge(Edge edge)
addEdge in class AbstractGraphModeledge - The edge to be added to the graph.public String toString()
public String toString(boolean fullThing)
toString in interface GraphModelfullThing - Unused.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||