V
- type of verticesE
- type of edgespublic interface Graph<V,E>
Modifier and Type | Method and Description |
---|---|
void |
addEdge(E edge,
V vertex1,
V vertex2)
Adds the given edge that connects vertex 1 to vertex 2.
|
void |
addVertex(V vertex)
Adds the given vertex to this graph.
|
java.util.Set<V> |
getAdjacentVertices(V vertex)
Returns vertices adjacent to the given vertex.
|
java.util.Set<E> |
getEdges()
Returns all edges in this graph.
|
java.util.Set<E> |
getEdges(V vertex)
Returns edges for the given vertex.
|
java.util.Set<V> |
getVertices()
Returns all vertices in this graph.
|
int |
numEdges()
Returns the number of edges.
|
int |
numVertices()
Returns the number of vertices.
|
java.util.Set<V> getVertices()
java.util.Set<V> getAdjacentVertices(V vertex)
vertex
- void addVertex(V vertex)
vertex
- int numVertices()
java.util.Set<E> getEdges()
java.util.Set<E> getEdges(V vertex)
vertex
- void addEdge(E edge, V vertex1, V vertex2)
edge
- vertex1
- vertex2
- int numEdges()