V
- the graph vertex typeE
- the graph edge typepublic class UndirectedSpecifics<V,E> extends Object implements Specifics<V,E>, Serializable
FastLookupUndirectedSpecifics
.Modifier and Type | Field and Description |
---|---|
protected AbstractBaseGraph<V,E> |
abstractBaseGraph |
protected EdgeSetFactory<V,E> |
edgeSetFactory |
protected Map<V,UndirectedEdgeContainer<V,E>> |
vertexMapUndirected |
Constructor and Description |
---|
UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph)
Construct a new undirected specifics.
|
UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph,
Map<V,UndirectedEdgeContainer<V,E>> vertexMap)
Construct a new undirected specifics.
|
UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph,
Map<V,UndirectedEdgeContainer<V,E>> vertexMap,
EdgeSetFactory<V,E> edgeSetFactory)
Construct a new undirected specifics.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdgeToTouchingVertices(E e)
Adds the specified edge to the edge containers of its source and target vertices.
|
boolean |
addVertex(V v)
Adds a vertex.
|
int |
degreeOf(V vertex)
Returns the degree of the specified vertex.
|
Set<E> |
edgesOf(V vertex)
Returns a set of all edges touching the specified vertex.
|
Set<E> |
getAllEdges(V sourceVertex,
V targetVertex)
Returns a set of all edges connecting source vertex to target vertex if such vertices exist
in this graph.
|
E |
getEdge(V sourceVertex,
V targetVertex)
Returns an edge connecting source vertex to target vertex if such vertices and such edge
exist in this graph.
|
protected UndirectedEdgeContainer<V,E> |
getEdgeContainer(V vertex)
Get the edge container for a specified vertex.
|
Set<V> |
getVertexSet()
Get the vertex set.
|
Set<E> |
incomingEdgesOf(V vertex)
Returns a set of all edges incoming into the specified vertex.
|
int |
inDegreeOf(V vertex)
Returns the "in degree" of the specified vertex.
|
int |
outDegreeOf(V vertex)
Returns the "out degree" of the specified vertex.
|
Set<E> |
outgoingEdgesOf(V vertex)
Returns a set of all edges outgoing from the specified vertex.
|
void |
removeEdgeFromTouchingVertices(E e)
Removes the specified edge from the edge containers of its source and target vertices.
|
protected AbstractBaseGraph<V,E> abstractBaseGraph
protected Map<V,UndirectedEdgeContainer<V,E>> vertexMapUndirected
protected EdgeSetFactory<V,E> edgeSetFactory
public UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph)
abstractBaseGraph
- the graph for which these specifics are forpublic UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph, Map<V,UndirectedEdgeContainer<V,E>> vertexMap)
abstractBaseGraph
- the graph for which these specifics are forvertexMap
- map for the storage of vertex edge setspublic UndirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph, Map<V,UndirectedEdgeContainer<V,E>> vertexMap, EdgeSetFactory<V,E> edgeSetFactory)
abstractBaseGraph
- the graph for which these specifics are forvertexMap
- map for the storage of vertex edge setsedgeSetFactory
- factory for the creation of vertex edge setspublic boolean addVertex(V v)
public Set<V> getVertexSet()
getVertexSet
in interface Specifics<V,E>
public Set<E> getAllEdges(V sourceVertex, V targetVertex)
null
, returns
null
. If both vertices exist but no edges found, returns an empty set.getAllEdges
in interface Specifics<V,E>
sourceVertex
- source vertex of the edge.targetVertex
- target vertex of the edge.public E getEdge(V sourceVertex, V targetVertex)
null
. If any of the specified vertices is null
returns null
In undirected graphs, the returned edge may have its source and target vertices in the opposite order.
public void addEdgeToTouchingVertices(E e)
addEdgeToTouchingVertices
in interface Specifics<V,E>
e
- the edgepublic int degreeOf(V vertex)
public Set<E> edgesOf(V vertex)
public int inDegreeOf(V vertex)
inDegreeOf
in interface Specifics<V,E>
vertex
- vertex whose in degree is to be calculated.public Set<E> incomingEdgesOf(V vertex)
incomingEdgesOf
in interface Specifics<V,E>
vertex
- the vertex for which the list of incoming edges to be returned.public int outDegreeOf(V vertex)
outDegreeOf
in interface Specifics<V,E>
vertex
- vertex whose out degree is to be calculated.public Set<E> outgoingEdgesOf(V vertex)
outgoingEdgesOf
in interface Specifics<V,E>
vertex
- the vertex for which the list of outgoing edges to be returned.public void removeEdgeFromTouchingVertices(E e)
removeEdgeFromTouchingVertices
in interface Specifics<V,E>
e
- the edgeprotected UndirectedEdgeContainer<V,E> getEdgeContainer(V vertex)
vertex
- a vertex in this graphCopyright © 2018. All rights reserved.