|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvisidia.graph.Graph
public class Graph
The Class Graph manages a graph as a set of vertices.
Field Summary | |
---|---|
protected int |
numberOfCreatedVertices
The number of created vertices. |
protected java.util.Vector<Vertex> |
vertices
The vertices. |
Constructor Summary | |
---|---|
Graph()
Instantiates a new graph. |
Method Summary | |
---|---|
void |
addVertex(Vertex vertex)
Adds the vertex. |
java.lang.Object |
clone()
Returns a clone of this graph (deep copy). |
int[] |
computeDistancesFrom(Vertex vertex)
Compute the distances (in number of edges) from this vertex to other vertices in graph. |
Vertex |
createVertex()
Creates a vertex. |
Vertex |
createVertex(int id)
Creates a vertex with specific id. |
java.util.Enumeration<Edge> |
getEdges()
Gets the edges. |
int |
getNbEdges()
Computes the number of edges in the graph. |
Vertex |
getVertex(int id)
Gets the vertex with this id. |
java.util.Enumeration<Vertex> |
getVertices()
Gets the vertices. |
int |
order()
Computes the graph order as the number of vertices in the graph. |
void |
removeVertex(Vertex vertex)
Removes the vertex. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector<Vertex> vertices
protected int numberOfCreatedVertices
Constructor Detail |
---|
public Graph()
Method Detail |
---|
public Vertex createVertex()
public Vertex createVertex(int id)
id
- the vertex id
public void addVertex(Vertex vertex)
vertex
- the vertexpublic void removeVertex(Vertex vertex)
vertex
- the vertexpublic Vertex getVertex(int id)
id
- the vertex id
public java.util.Enumeration<Vertex> getVertices()
public java.util.Enumeration<Edge> getEdges()
public int order()
public int getNbEdges()
public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public int[] computeDistancesFrom(Vertex vertex)
vertex
- the first vertex
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |