public class MutableAdjacencyListsGraph<V extends Vertex,E extends Edge<V>> extends Object implements MutableGraph<V,E>
Constructor and Description |
---|
MutableAdjacencyListsGraph(Set<V> vertex,
Set<E> edge)
Creates a graph comprising of the specified vertexes and edges.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(E edge)
Adds the specified edge to this graph.
|
void |
addVertex(V vertex)
Adds the specified vertex to this graph.
|
void |
clear()
Clear the graph.
|
boolean |
equals(Object obj) |
Set<E> |
getEdges()
Returns the set of edges comprising the graph.
|
Set<E> |
getEdgesFrom(V src)
Returns all edges leading out from the specified source vertex.
|
Set<E> |
getEdgesTo(V dst)
Returns all edges leading towards the specified destination vertex.
|
Set<V> |
getVertexes()
Returns the set of vertexes comprising the graph.
|
int |
hashCode() |
void |
removeEdge(E edge)
Removes the specified edge from the graph.
|
void |
removeVertex(V vertex)
Removes the specified vertex from the graph.
|
Graph<V,E> |
toImmutable()
Returns an immutable copy of this graph.
|
String |
toString() |
public Set<V> getVertexes()
Graph
public Set<E> getEdges()
Graph
public Set<E> getEdgesFrom(V src)
Graph
public Set<E> getEdgesTo(V dst)
Graph
public void addVertex(V vertex)
MutableGraph
public void removeVertex(V vertex)
MutableGraph
removeVertex
in interface MutableGraph<V extends Vertex,E extends Edge<V>>
vertex
- vertex to be removedpublic void addEdge(E edge)
MutableGraph
public void removeEdge(E edge)
MutableGraph
removeEdge
in interface MutableGraph<V extends Vertex,E extends Edge<V>>
edge
- edge to be removedpublic Graph<V,E> toImmutable()
MutableGraph
toImmutable
in interface MutableGraph<V extends Vertex,E extends Edge<V>>
public void clear()