public interface Graph<V,E>
Modifier and Type | Method and Description |
---|---|
boolean |
areAdjacent(Vertex<V> u,
Vertex<V> v)
Tests whether two vertices are adjacent
|
java.lang.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
|
java.lang.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
|
java.lang.Iterable<Vertex<V>> |
vertices()
Returns the vertices of the graph as an iterable collection
|
boolean areAdjacent(Vertex<V> u, Vertex<V> v) throws InvalidPositionException
InvalidPositionException
Vertex[] endVertices(Edge<E> e) throws InvalidPositionException
InvalidPositionException
java.lang.Iterable<Edge<E>> incidentEdges(Vertex<V> v) throws InvalidPositionException
InvalidPositionException
Edge<E> insertEdge(Vertex<V> u, Vertex<V> v, E o) throws InvalidPositionException
InvalidPositionException
int numEdges()
int numVertices()
Vertex<V> opposite(Vertex<V> v, Edge<E> e) throws InvalidPositionException
InvalidPositionException
E removeEdge(Edge<E> e) throws InvalidPositionException
InvalidPositionException
V removeVertex(Vertex<V> v) throws InvalidPositionException
InvalidPositionException
E replace(Edge<E> p, E o) throws InvalidPositionException
InvalidPositionException
V replace(Vertex<V> p, V o) throws InvalidPositionException
InvalidPositionException