|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ls.Graph
This class creates an undirected graph that will contain a list of vertices and edges for the graph. It is a base class for most types of graphs.
| Field Summary | |
protected java.util.Vector |
edges
|
protected java.util.Vector |
vertices
|
| Constructor Summary | |
Graph()
Creates a new graph with no verctices or edges. |
|
Graph(java.util.Vector vertices,
java.util.Vector edges)
Creates a graph with the give set of vertices and edges |
|
| Method Summary | |
void |
addEdge(Edge e)
Adds a new edge to the graph. |
void |
addEdge(java.lang.Object o1,
java.lang.Object o2)
Adds a new edge to the graph. |
void |
addEdge(Vertex v1,
Vertex v2)
Adds a new edge to the graph. |
void |
addVertex(java.lang.Object o)
Adds a new vertex to the graph. |
void |
addVertex(Vertex v)
Adds a new vertex to the graph. |
boolean |
existsEdge(Edge e)
Tests to see if the given edge already exists in the graph. |
java.util.Vector |
findEdges(java.lang.Object v)
Finds all of the edges that contain a particular vertex |
Edge |
getEdge(int index)
Returns the edge at the specific location in the graph. |
java.util.Vector |
getEdges()
Returns a list of all the edges in the graph |
Vertex |
getVertex(int index)
Returns the vertex at the specified location. |
java.util.Vector |
getVertices()
Returns all of the vertices in the graph. |
int |
numEdges()
Retuns the number of edges that are in the graph. |
int |
numVertices()
Returns the number of vertices that are in the graph. |
void |
print()
Prints out the entire graph structure. |
void |
printAddress()
|
void |
setEdges(java.util.Vector edges)
Sets all of the edges in the graph to be the one in this particular list. |
void |
setVertices(java.util.Vector vertices)
Sets all of the vertices in the graph to be of a certian set |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector vertices
protected java.util.Vector edges
| Constructor Detail |
public Graph()
public Graph(java.util.Vector vertices,
java.util.Vector edges)
vertices - the set of verticesedges - the set of edges| Method Detail |
public void addVertex(java.lang.Object o)
o - the vertex to be addedpublic void addVertex(Vertex v)
v - the vertex to be added
public void addEdge(java.lang.Object o1,
java.lang.Object o2)
o1 - one end of the edgeo2 - the other end of the edge
public void addEdge(Vertex v1,
Vertex v2)
v1 - one end of the edgev2 - the other end of the edgepublic void addEdge(Edge e)
e - the edge to be addedpublic boolean existsEdge(Edge e)
e - - the edge that is being looked forpublic int numVertices()
public int numEdges()
public java.util.Vector getVertices()
public void setVertices(java.util.Vector vertices)
vertices - - the list of verticespublic java.util.Vector getEdges()
public void setEdges(java.util.Vector edges)
edges - the list of edgespublic Vertex getVertex(int index)
index - the vertex at this locationpublic Edge getEdge(int index)
index - the edge at this locationpublic java.util.Vector findEdges(java.lang.Object v)
v - the vertex who's edges we are looking forpublic void print()
public void printAddress()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||