V
- Class of vertices this Graph will contain (extends Vertex
.E
- Class of edges this Graph will have (extends Edge
<V>.public interface Graph<V extends Vertex,E extends Edge<V>>
Modifier and Type | Method and Description |
---|---|
E |
addEdge(V source,
V target)
Method that add a new edge that join the parameter vertices.
|
boolean |
addVertex(V vertex)
Method to add a new Vertex to the graph.
|
default boolean |
containsEdge(E edge)
Method to check if an edge is contained in the graph,
|
default boolean |
containsEdge(V source,
V target)
Method to check if an edge with a source and target vertices is contained in the graph,
|
boolean |
containsVertex(V vertex)
Method to check if a vertex is contained in the graph,
|
java.util.Set<E> |
edgeSet()
Method that returns the set of Edges contained in this graph.
|
default java.util.Set<E> |
edgesFrom(V vertex)
Method that return a set of edge where everyone has a certain source vertex.
|
default java.util.Set<E> |
edgesOf(V vertex)
Method to get a set with all the edges that has as source or target a certain vertex.
|
default java.util.Set<E> |
edgesTo(V vertex)
Method that return a set of edge where everyone has a certain target vertex.
|
default java.util.Set<E> |
getAllEdges(V ver1,
V ver2)
Method to get all the edges related with two vertices at the same time.
|
default E |
getEdge(V source,
V target)
Getter method for an edge of the graph joining two vertices of the graph.
|
java.lang.Class<? extends E> |
getEdgeClass()
Method to get the Edge class of the Graph.
|
EdgeFactory<V,E> |
getEdgeFactory()
Method to get the Edge Factory to create new edges for this graph.
|
default V |
getEdgeSource(E edge)
Method to get the source vertex of an edge of the graph.
|
default V |
getEdgeTarget(E edge)
Method to get the target vertex of an edge of the graph.
|
default double |
getEdgeWeight(E edge)
Method that gets the weight of a particular edge of the graph.
|
java.lang.Class<? extends V> |
getVertexClass()
Method to get the Vertex class of the Graph.
|
VertexFactory<V> |
getVertexFactory()
Method to get the Vertex Factory to create new edges for this graph.
|
default boolean |
removeAllEdges(java.util.Collection<? extends E> edges)
Method that removes a collection of vertices.
|
default java.util.Set<E> |
removeAllEdges(V ver1,
V ver2)
Method that remove the edges related to two vertices.
|
default boolean |
removeAllVertices(java.util.Collection<? extends V> vertices)
Method that removes a collection of vertices.
|
boolean |
removeEdge(E edge)
Method to remove an edge of the graph.
|
default E |
removeEdge(V source,
V target)
Method to remove an edge given the source and the target vertices.
|
boolean |
removeVertex(V vertex)
Method that remove a vertex from the graph.
|
default java.util.Set<V> |
vertexFrom(V vertex)
Method to get all the vertices we can reach from a certain vertex.
|
java.util.Set<V> |
vertexSet()
Method that returns the set of Vertex contained in this graph.
|
default java.util.Set<V> |
vertexTo(V vertex)
Method to get all the vertices from we can reach a certain vertex.
|
boolean addVertex(V vertex)
vertex
- The vertex we will add.E addEdge(V source, V target)
source
- Vertex from the edge will go.target
- Vertex to the edge will go.boolean removeVertex(V vertex)
vertex
- Vertex we want to remove.default boolean removeAllVertices(java.util.Collection<? extends V> vertices)
removeVertex(Vertex)
.vertices
- Collection of vertices to remove.boolean removeEdge(E edge)
edge
- Edge we want to remove from the graph.default E removeEdge(V source, V target)
source
- Source vertex of the edge we want remove.target
- Target vertex of the edge we want remove.default boolean removeAllEdges(java.util.Collection<? extends E> edges)
removeEdge(Edge)
.edges
- Collection of edges to remove.default java.util.Set<E> removeAllEdges(V ver1, V ver2)
ver1
- One vertex.ver2
- Another vertex.VertexFactory<V> getVertexFactory()
VertexFactory
<V>EdgeFactory<V,E> getEdgeFactory()
EdgeFactory
<V,E>java.util.Set<V> vertexSet()
java.util.Set<E> edgeSet()
default E getEdge(V source, V target)
source
- Source vertex of the edge returned.target
- Target vertex of the edge returned.default V getEdgeSource(E edge)
edge
- Edge where we want to look.default V getEdgeTarget(E edge)
edge
- Edge where we want to look.default double getEdgeWeight(E edge)
edge
- Edge we want to check.boolean containsVertex(V vertex)
vertex
- Vertex to check.default boolean containsEdge(E edge)
edge
- Edge to check.default boolean containsEdge(V source, V target)
source
- Source vertex of the edge searched.target
- Target vertex of the edge searched.default java.util.Set<E> edgesFrom(V vertex)
vertex
- Vertex we search as source.default java.util.Set<E> edgesTo(V vertex)
vertex
- Vertex we search as target.default java.util.Set<E> edgesOf(V vertex)
vertex
- Vertex we are searchingdefault java.util.Set<E> getAllEdges(V ver1, V ver2)
ver1
- A vertex to search.ver2
- Another vertex to search.default java.util.Set<V> vertexFrom(V vertex)
vertex
- Vertex from we want to find another vertices.default java.util.Set<V> vertexTo(V vertex)
vertex
- Vertex we want to find from another vertices.java.lang.Class<? extends V> getVertexClass()
java.lang.Class<? extends E> getEdgeClass()