V
- the graph vertex typeE
- the graph edge typepublic class FastLookupDirectedSpecifics<V,E> extends DirectedSpecifics<V,E>
DirectedSpecifics
instead.Modifier and Type | Field and Description |
---|---|
protected Map<Pair<V,V>,Set<E>> |
touchingVerticesToEdgeMap
Maps a pair of vertices <u,v> to a set of edges {(u,v)}.
|
edgeSetFactory, graph, vertexMap
Constructor and Description |
---|
FastLookupDirectedSpecifics(Graph<V,E> graph,
Map<V,DirectedEdgeContainer<V,E>> vertexMap,
Map<Pair<V,V>,Set<E>> touchingVerticesToEdgeMap,
EdgeSetFactory<V,E> edgeSetFactory)
Construct a new fast lookup directed specifics.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEdgeToTouchingVertices(V sourceVertex,
V targetVertex,
E e)
Adds the specified edge to the edge containers of its source and target vertices.
|
boolean |
addEdgeToTouchingVerticesIfAbsent(V sourceVertex,
V targetVertex,
E e)
Adds the specified edge to the edge containers of its source and target vertices only if the
edge is not already in the graph.
|
protected void |
addToIndex(V sourceVertex,
V targetVertex,
E e)
Add an edge to the index.
|
E |
createEdgeToTouchingVerticesIfAbsent(V sourceVertex,
V targetVertex,
Supplier<E> edgeSupplier)
Creates an edge given an edge supplier and adds it to the edge containers of its source and
target vertices only if the graph does not contain other edges with the same source and
target vertices.
|
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.
|
void |
removeEdgeFromTouchingVertices(E e)
Deprecated.
|
void |
removeEdgeFromTouchingVertices(V sourceVertex,
V targetVertex,
E e)
Removes the specified edge from the edge containers of its source and target vertices.
|
protected void |
removeFromIndex(V sourceVertex,
V targetVertex,
E e)
Remove an edge from the index.
|
addEdgeToTouchingVertices, addVertex, degreeOf, edgesOf, getEdgeContainer, getVertexSet, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf
public FastLookupDirectedSpecifics(Graph<V,E> graph, Map<V,DirectedEdgeContainer<V,E>> vertexMap, Map<Pair<V,V>,Set<E>> touchingVerticesToEdgeMap, EdgeSetFactory<V,E> edgeSetFactory)
graph
- the graph for which these specifics are forvertexMap
- map for the storage of vertex edge sets. Needs to have a predictable
iteration order.touchingVerticesToEdgeMap
- Additional map for caching. No need for a predictable
iteration order.edgeSetFactory
- factory for the creation of vertex edge setspublic Set<E> getAllEdges(V sourceVertex, V targetVertex)
DirectedSpecifics
null
, returns
null
. If both vertices exist but no edges found, returns an empty set.getAllEdges
in interface Specifics<V,E>
getAllEdges
in class DirectedSpecifics<V,E>
sourceVertex
- source vertex of the edge.targetVertex
- target vertex of the edge.public E getEdge(V sourceVertex, V targetVertex)
DirectedSpecifics
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 boolean addEdgeToTouchingVertices(V sourceVertex, V targetVertex, E e)
DirectedSpecifics
addEdgeToTouchingVertices
in interface Specifics<V,E>
addEdgeToTouchingVertices
in class DirectedSpecifics<V,E>
sourceVertex
- the source vertextargetVertex
- the target vertexe
- the edgepublic boolean addEdgeToTouchingVerticesIfAbsent(V sourceVertex, V targetVertex, E e)
Specifics
addEdgeToTouchingVerticesIfAbsent
in interface Specifics<V,E>
addEdgeToTouchingVerticesIfAbsent
in class DirectedSpecifics<V,E>
sourceVertex
- the source vertextargetVertex
- the target vertexe
- the edgepublic E createEdgeToTouchingVerticesIfAbsent(V sourceVertex, V targetVertex, Supplier<E> edgeSupplier)
Specifics
createEdgeToTouchingVerticesIfAbsent
in interface Specifics<V,E>
createEdgeToTouchingVerticesIfAbsent
in class DirectedSpecifics<V,E>
sourceVertex
- the source vertextargetVertex
- the target vertexedgeSupplier
- the function which will create the edge@Deprecated public void removeEdgeFromTouchingVertices(E e)
DirectedSpecifics
removeEdgeFromTouchingVertices
in interface Specifics<V,E>
removeEdgeFromTouchingVertices
in class DirectedSpecifics<V,E>
e
- the edgepublic void removeEdgeFromTouchingVertices(V sourceVertex, V targetVertex, E e)
DirectedSpecifics
removeEdgeFromTouchingVertices
in interface Specifics<V,E>
removeEdgeFromTouchingVertices
in class DirectedSpecifics<V,E>
sourceVertex
- the source vertextargetVertex
- the target vertexe
- the edgeprotected void addToIndex(V sourceVertex, V targetVertex, E e)
sourceVertex
- the source vertextargetVertex
- the target vertexe
- the edgeCopyright © 2019. All rights reserved.