V
- vertex typeE
- edge typepublic class Graph<V,E extends IGraphEdge<V>> extends Object implements IGraph<V,E>
IGraph
.Constructor and Description |
---|
Graph() |
Modifier and Type | Method and Description |
---|---|
boolean |
addVertex(V vertex)
Adds a vertex to the graph.
|
void |
addVertices(Collection<V> vertices)
Adds a collection of vertices to the graph.
|
E |
getEdge(V from,
V to)
Gets the edge in the graph that connects the two specified vertices.
|
Set<E> |
getIncomingEdges(V vertex)
Finds all the edges terminating at the specified vertex.
|
Set<E> |
getOutgoingEdges(V vertex)
Finds all the edges emanating from the specified vertex.
|
Set<V> |
getVertices()
Gets the set of all vertices in the graph.
|
E |
removeEdge(E edge)
Removes the specified edge or the edge in the graph that conects the same
two vertices as the specified edge from the graph.
|
void |
removeVertex(V vertex)
Removes a vertex from the graph
|
E |
setEdge(E edge)
Set the edge between the vertex returned from
IGraphEdge.getFrom() and the vertex returned from
IGraphEdge.getTo() . |
public boolean addVertex(V vertex)
IGraph
public void removeVertex(V vertex)
IGraph
removeVertex
in interface IGraph<V,E extends IGraphEdge<V>>
vertex
- Vertex to remove.public void addVertices(Collection<V> vertices)
vertices
- Collection of vertices to add.public E setEdge(E edge)
IGraph
IGraphEdge.getFrom()
and the vertex returned from
IGraphEdge.getTo()
. The the graph already contained an edge
between those two vertices that edge is replaced with the specified edge
and returned from this method.public Set<E> getOutgoingEdges(V vertex)
IGraph
getOutgoingEdges
in interface IGraph<V,E extends IGraphEdge<V>>
public Set<E> getIncomingEdges(V vertex)
IGraph
getIncomingEdges
in interface IGraph<V,E extends IGraphEdge<V>>
public E removeEdge(E edge)
IGraph
removeEdge
in interface IGraph<V,E extends IGraphEdge<V>>
edge
- Edge to remove from the graph.public Set<V> getVertices()
IGraph
getVertices
in interface IGraph<V,E extends IGraphEdge<V>>
Copyright © 2016 The Apache Software Foundation. All rights reserved.