V
- the graph vertex typeE
- the graph edge typepublic class UndirectedSpecifics<V,E> extends Specifics<V,E> implements 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.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdgeToTouchingVertices(E e)
Adds the specified edge to the edge containers of its source and target vertices.
|
void |
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)
A lazy build of edge container for 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
- a container to use for the edgespublic void addVertex(V v)
public Set<V> getVertexSet()
getVertexSet
in class 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 class 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 class Specifics<V,E>
e
- the edgepublic int degreeOf(V vertex)
public Set<E> edgesOf(V vertex)
public int inDegreeOf(V vertex)
inDegreeOf
in class Specifics<V,E>
vertex
- vertex whose in degree is to be calculated.public Set<E> incomingEdgesOf(V vertex)
incomingEdgesOf
in class Specifics<V,E>
vertex
- the vertex for which the list of incoming edges to be returned.public int outDegreeOf(V vertex)
outDegreeOf
in class Specifics<V,E>
vertex
- vertex whose out degree is to be calculated.public Set<E> outgoingEdgesOf(V vertex)
outgoingEdgesOf
in class Specifics<V,E>
vertex
- the vertex for which the list of outgoing edges to be returned.public void removeEdgeFromTouchingVertices(E e)
removeEdgeFromTouchingVertices
in class Specifics<V,E>
e
- the edgeprotected UndirectedEdgeContainer<V,E> getEdgeContainer(V vertex)
vertex
- a vertex in this graphCopyright © 2016. All rights reserved.