|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgraph.MyGraph
public class MyGraph
| Field Summary |
|---|
| Fields inherited from interface support.graph.AdjacencyMatrixGraph |
|---|
FROMVERTEX, MAX_VERTICES, POSITION, TOVERTEX, VERTEX_NUMBER |
| Constructor Summary | |
|---|---|
MyGraph()
Constructor for your Graph, where among other things, you will most likely want to instantiate your matrix array, and your NodeSequence's. |
|
| Method Summary | |
|---|---|
boolean |
areAdjacent(CS16Vertex v1,
CS16Vertex v2)
Returns true if there exists an Edge that connects Vertex v1 and Vertex v2. |
void |
clear()
Clears all the vertices and edges from the graph. |
CS16Edge |
connectingEdge(CS16Vertex v1,
CS16Vertex v2)
Returns the edge that connects the two vertices. |
Iterator<CS16Edge> |
edges()
Returns an iterator holding all the Edge's of the graph. |
CS16Vertex[] |
endVertices(CS16Edge e)
Returns the two Vertex's that the Edge e is incident upon. |
Iterator<CS16Edge> |
incidentEdges(CS16Vertex v)
Returns an Iterator over all the Edges that are connected to this Vertex. |
CS16Edge |
insertEdge(CS16Vertex v1,
CS16Vertex v2,
Object edgeElement)
Inserts a new Edge into your Graph. |
CS16Vertex |
insertVertex(Object vertElement)
Inserts a new Vertex into your Graph. |
CS16Vertex |
opposite(CS16Vertex v,
CS16Edge e)
Returns the Vertex that is on the other side of Edge e opposite of Vertex v. |
Object |
removeEdge(CS16Edge e)
Removes an Edge from your Graph. |
Object |
removeVertex(CS16Vertex v)
Removes a Vertex from your graph. |
Iterator<CS16Vertex> |
vertices()
Returns an iterator holding all the Vertex's of the graph. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MyGraph()
NodeSequence| Method Detail |
|---|
public CS16Vertex insertVertex(Object vertElement)
insertVertex in interface AdjacencyMatrixGraphvertElement - The element of the inserted Vertex.
public CS16Edge insertEdge(CS16Vertex v1,
CS16Vertex v2,
Object edgeElement)
throws InvalidVertexException
insertEdge in interface AdjacencyMatrixGraphv1 - The first vertex of the edge connection.v2 - The second vertex of the edge connection.edgeElement - The element of the newly inserted edge.
InvalidVertexException - Thrown when the Vertex is not valid.
public Object removeVertex(CS16Vertex v)
throws InvalidVertexException
removeVertex in interface AdjacencyMatrixGraphv - The Vertex to remove.
InvalidVertexException - Thrown when the Vertex is not valid.
public Object removeEdge(CS16Edge e)
throws InvalidEdgeException
removeEdge in interface AdjacencyMatrixGraphe - The Edge to remove.
InvalidEdgeException - Thrown when the Edge is not valid.
public CS16Edge connectingEdge(CS16Vertex v1,
CS16Vertex v2)
throws InvalidVertexException,
NoSuchEdgeException
connectingEdge in interface AdjacencyMatrixGraphv1 - The first vertex that may be connected.v2 - The second vertex that may be connected.
InvalidVertexException - Thrown when either vertex is invalid.
NoSuchEdgeException - Thrown when no edge connects the vertices.
public Iterator<CS16Edge> incidentEdges(CS16Vertex v)
throws InvalidVertexException
incidentEdges in interface AdjacencyMatrixGraphv - The vertex to find the incident edges on.
InvalidVertexException - Thrown when the Vertex is not valid.This must run in O(n) time;
public CS16Vertex opposite(CS16Vertex v,
CS16Edge e)
throws InvalidVertexException,
InvalidEdgeException,
NoSuchVertexException
opposite in interface AdjacencyMatrixGraphv - The first vertex on Edge e.e - The edge connecting Vertex v and the uknown opposite Vertex.
InvalidVertexException - Thrown when the Vertex is not valid.
InvalidEdgeException - Thrown when the Edge isnot valid.
NoSuchVertexException - Thrown when Edge e is not incident on v.
public CS16Vertex[] endVertices(CS16Edge e)
throws InvalidEdgeException
endVertices in interface AdjacencyMatrixGraphe - The edge to find the connecting Vertex's on.
InvalidEdgeException - Thrown when the Edge e is not valid.
public boolean areAdjacent(CS16Vertex v1,
CS16Vertex v2)
throws InvalidVertexException
areAdjacent in interface AdjacencyMatrixGraphv1 - The first Vertex to test adjacency.v2 - The second Vertex to test adjacency.
InvalidVertexException - Thrown if either vertex is invalid.public Iterator<CS16Edge> edges()
edges in interface AdjacencyMatrixGraphThis must run in O(m) time.public Iterator<CS16Vertex> vertices()
vertices in interface AdjacencyMatrixGraphThis must run in O(n) time.public void clear()
clear in interface AdjacencyMatrixGraph
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||