|
|||
| PREV CLASS NEXT CLASS | |||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object | +--ch.ethz.graphbench.toolbox.Graph
Class representing a graph in 2D eucledian space.
Cannot be instantiated directly, use the Graph instance provided
by the GraphAlgorithm.
| Method Summary | |
Edge |
createEdge(Vertex from,
Vertex to)
Creates a new Edge, adds it to the graph and returns it. |
Vertex |
createVertex(java.awt.Point p)
Creates a new vertex and adds it to the graph. |
Edge |
getEdge(Vertex from,
Vertex to)
Returns the edge connecting the two vertices. |
int |
getEdgeCount()
Returns the number of edges of the graph. |
java.util.Iterator |
getEdgeIterator()
Returns an iterator over all edges. |
Vertex |
getVertex(int index)
Gets the vertex with the given index. |
int |
getVertexCount()
Returns the number of vertices of the graph. |
java.util.Iterator |
getVertexIterator()
Returns an iterator over all vertices. |
boolean |
isDirected()
Returns if the graph has directed edges or not. |
void |
removeAllEdges()
Removes all edges from the graph. |
void |
removeAllVertices()
Removes all vertices and therefor also all edges. |
void |
removeEdge(Edge edge)
Removes an edge from the graph. |
void |
removeVertex(Vertex vertex)
Removes a vertex from the graph. |
void |
resetStates()
Resets the states of all vertices and edges. |
void |
setDirected(boolean directed)
Sets if the graph has directed edges or not. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public void setDirected(boolean directed)
isDirected - Boolean value specifying if graph is direced.public int getVertexCount()
public int getEdgeCount()
public Edge getEdge(Vertex from,
Vertex to)
from - The starting vertex of the edge.to - The ending vertex of the edge.public java.util.Iterator getEdgeIterator()
public java.util.Iterator getVertexIterator()
public Vertex getVertex(int index)
i - Index of the vertex to be returned.public boolean isDirected()
true if graph has directed edges, false otherwise.public Vertex createVertex(java.awt.Point p)
p - The eucledian position of the vertex to be created.
public Edge createEdge(Vertex from,
Vertex to)
from - The starting vertex of the edge.to - The ending vertex of the edge.public void removeEdge(Edge edge)
edge - The edge to be removed.public void removeAllEdges()
public void removeVertex(Vertex vertex)
vertex - The vertex to be removed.public void removeAllVertices()
public void resetStates()
|
|||
| PREV CLASS NEXT CLASS | |||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||