|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscratch.tom.simpleGraph.DefaultGraph<V,E>
V
- type of the verticesE
- type of the edgespublic class DefaultGraph<V,E extends Edge<V>>
an example implementation of Graph
Constructor Summary | |
---|---|
DefaultGraph()
|
Method Summary | |
---|---|
void |
addEdge(E edge)
note that vertices in the new edge are added to the graph if not there already |
void |
addEdges(Collection<E> edges)
note that vertices in the new edges are added to the graph if not there already |
void |
addVertex(V vertex)
|
void |
addVertices(Collection<V> vertices)
|
int |
getEdgeCount()
|
Collection<E> |
getEdges()
|
int |
getVertexCount()
|
Collection<V> |
getVertices()
|
boolean |
removeEdge(E edge)
|
boolean |
removeEdges(Collection<E> edges)
|
boolean |
removeVertex(V vertex)
remove the vertex. |
boolean |
removeVertices(Collection<V> vertices)
remove all vertices in the passed collection, If any existing edges contain any vertices from the passed collection, remove those edges, too. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultGraph()
Method Detail |
---|
public Collection<V> getVertices()
getVertices
in interface Graph<V,E extends Edge<V>>
public Collection<E> getEdges()
getEdges
in interface Graph<V,E extends Edge<V>>
public int getVertexCount()
public int getEdgeCount()
public void addVertex(V vertex)
addVertex
in interface Graph<V,E extends Edge<V>>
public boolean removeVertex(V vertex)
removeVertex
in interface Graph<V,E extends Edge<V>>
public void addVertices(Collection<V> vertices)
addVertices
in interface Graph<V,E extends Edge<V>>
public boolean removeVertices(Collection<V> vertices)
removeVertices
in interface Graph<V,E extends Edge<V>>
public void addEdge(E edge)
addEdge
in interface Graph<V,E extends Edge<V>>
public boolean removeEdge(E edge)
removeEdge
in interface Graph<V,E extends Edge<V>>
public void addEdges(Collection<E> edges)
addEdges
in interface Graph<V,E extends Edge<V>>
public boolean removeEdges(Collection<E> edges)
removeEdges
in interface Graph<V,E extends Edge<V>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |