public class AdjacencyListsGraph extends Object implements MutableGraph
Not thread-safe, thus must be guarded externally against concurrent updates.
Constructor and Description |
---|
AdjacencyListsGraph() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Edge edge)
Adds the specified edge to the graph.
|
boolean |
add(Vertex vertex)
Adds the specified vertex to the graph.
|
Set<Edge> |
getEdges()
Gets the set of all graph edges.
|
Set<Edge> |
getEdgesFrom(Vertex src)
Gets the set of all edges leading from the given source vertex.
|
Set<Edge> |
getEdgesTo(Vertex dst)
Gets the set of all edges leading from the given source vertex.
|
Set<Vertex> |
getVertices()
Gets the set of all graph vertices.
|
boolean |
remove(Edge edge)
Deletes the specified edge from the graph.
|
boolean |
remove(Vertex vertex)
Deletes the specified vertex from the graph.
|
public Set<Vertex> getVertices()
Graph
getVertices
in interface Graph
public Set<Edge> getEdges()
Graph
public Set<Edge> getEdgesFrom(Vertex src)
Graph
getEdgesFrom
in interface Graph
src
- source vertexpublic Set<Edge> getEdgesTo(Vertex dst)
Graph
getEdgesTo
in interface Graph
dst
- target vertexpublic boolean add(Vertex vertex)
MutableGraph
add
in interface MutableGraph
vertex
- vertex to be addedpublic boolean remove(Vertex vertex)
MutableGraph
remove
in interface MutableGraph
vertex
- vertex to be removedpublic boolean add(Edge edge)
MutableGraph
add
in interface MutableGraph
edge
- edge to be addedpublic boolean remove(Edge edge)
MutableGraph
remove
in interface MutableGraph
edge
- edge to be removedCopyright © 2016. All Rights Reserved.