V
- the graph vertex typeE
- the graph edge typepublic class DirectedSpecifics<V,E> extends Object implements Specifics<V,E>, Serializable
FastLookupDirectedSpecifics
.Modifier and Type | Field and Description |
---|---|
protected AbstractBaseGraph<V,E> |
abstractBaseGraph |
protected EdgeSetFactory<V,E> |
edgeSetFactory |
protected Map<V,DirectedEdgeContainer<V,E>> |
vertexMapDirected |
Constructor and Description |
---|
DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph)
Construct a new directed specifics.
|
DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph,
Map<V,DirectedEdgeContainer<V,E>> vertexMap)
Construct a new directed specifics.
|
DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph,
Map<V,DirectedEdgeContainer<V,E>> vertexMap,
EdgeSetFactory<V,E> edgeSetFactory)
Construct a new directed 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 DirectedEdgeContainer<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,DirectedEdgeContainer<V,E>> vertexMapDirected
protected EdgeSetFactory<V,E> edgeSetFactory
public DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph)
abstractBaseGraph
- the graph for which these specifics are forpublic DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph, Map<V,DirectedEdgeContainer<V,E>> vertexMap)
abstractBaseGraph
- the graph for which these specifics are forvertexMap
- map for the storage of vertex edge setspublic DirectedSpecifics(AbstractBaseGraph<V,E> abstractBaseGraph, Map<V,DirectedEdgeContainer<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 void 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 DirectedEdgeContainer<V,E> getEdgeContainer(V vertex)
vertex
- a vertex in this graph.Copyright © 2017. All rights reserved.