|
net.datastructures - version 5.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph<V,E>
An interface for a graph.
Method Summary | |
---|---|
boolean |
areAdjacent(Vertex<V> u,
Vertex<V> v)
Tests whether two vertices are adjacent |
Iterable<Edge<E>> |
edges()
Returns the edges of the graph as an iterable collection |
Vertex[] |
endVertices(Edge<E> e)
Returns the endvertices of a vertex as an array of length 2 |
Iterable<Edge<E>> |
incidentEdges(Vertex<V> v)
Returns the edges incident on a vertex as an iterable collection |
Edge<E> |
insertEdge(Vertex<V> u,
Vertex<V> v,
E o)
Inserts and return a new edge with a given element between two vertices |
Vertex<V> |
insertVertex(V o)
Inserts and return a new vertex with a given element |
int |
numEdges()
Returns the number of edges of the graph |
int |
numVertices()
Returns the number of vertices of the graph |
Vertex<V> |
opposite(Vertex<V> v,
Edge<E> e)
Returns the other endvertex of an incident edge |
E |
removeEdge(Edge<E> e)
Removes an edge and return its element |
V |
removeVertex(Vertex<V> v)
Removes a vertex and all its incident edges and returns the element stored at the removed vertex |
E |
replace(Edge<E> p,
E o)
Replaces the element of a given edge with a new element and returns the old element |
V |
replace(Vertex<V> p,
V o)
Replaces the element of a given vertex with a new element and returns the old element |
Iterable<Vertex<V>> |
vertices()
Returns the vertices of the graph as an iterable collection |
Method Detail |
---|
int numVertices()
int numEdges()
Iterable<Vertex<V>> vertices()
Iterable<Edge<E>> edges()
V replace(Vertex<V> p, V o) throws InvalidPositionException
InvalidPositionException
E replace(Edge<E> p, E o) throws InvalidPositionException
InvalidPositionException
Iterable<Edge<E>> incidentEdges(Vertex<V> v) throws InvalidPositionException
InvalidPositionException
Vertex[] endVertices(Edge<E> e) throws InvalidPositionException
InvalidPositionException
Vertex<V> opposite(Vertex<V> v, Edge<E> e) throws InvalidPositionException
InvalidPositionException
boolean areAdjacent(Vertex<V> u, Vertex<V> v) throws InvalidPositionException
InvalidPositionException
Vertex<V> insertVertex(V o)
Edge<E> insertEdge(Vertex<V> u, Vertex<V> v, E o) throws InvalidPositionException
InvalidPositionException
V removeVertex(Vertex<V> v) throws InvalidPositionException
InvalidPositionException
E removeEdge(Edge<E> e) throws InvalidPositionException
InvalidPositionException
|
net.datastructures - version 5.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |