Class AdjacencyMap
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.graph.adjacency.AdjacencyMap
-
public class AdjacencyMap extends Object
AnAdjacencyMap
is used to store the contents of a graph in memory in a format which can easily be interrogated.
-
-
Constructor Summary
Constructors Constructor Description AdjacencyMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsDestination(Object destination)
Determines whether this AdjacencyMap contains the specified destination vertex.boolean
containsSource(Object source)
Determines whether this AdjacencyMap contains the specified source vertex.Set<Object>
getAllDestinations()
Get aSet
containing all of the destination vertices in this AdjacencyMap.Set<Object>
getAllSources()
Get aSet
containing all of the source vertices in this AdjacencyMap.Set<Object>
getDestinations(Object source)
Given a source vertex, get all of the vertices which can be reached from that source.Set<Edge>
getEdges(Object source, Object destination)
Get the entries in the AdjacencyMap which match the provided source and destination vertices.Set<Object>
getSources(Object destination)
Given a destination vertex, get all of the vertices which are linked to that destination.Set<Edge>
putEdge(Object source, Object destination, Edge edge)
Add an entry to the AdjacencyMap.Set<Edge>
putEdges(Object source, Object destination, Set<Edge> set)
Add an entry to the AdjacencyMap.void
removeAllWithDestination(Object destination)
Given a vertex, remove all entries in the AdjacencyMap which have this vertex as a destination.String
toString()
String
toStringFull()
-
-
-
Method Detail
-
getEdges
public Set<Edge> getEdges(Object source, Object destination)
Get the entries in the AdjacencyMap which match the provided source and destination vertices.- Parameters:
source
- the source vertexdestination
- the destination vertex- Returns:
- the
Set
of edge objects relating to the specified vertices
-
putEdges
public Set<Edge> putEdges(Object source, Object destination, Set<Edge> set)
Add an entry to the AdjacencyMap.- Parameters:
source
- the source vertexdestination
- the destination vertexset
- theSet
of edge objects to associate with the specified pair of vertices.- Returns:
- the added edge objects
-
putEdge
public Set<Edge> putEdge(Object source, Object destination, Edge edge)
Add an entry to the AdjacencyMap.- Parameters:
source
- the source vertexdestination
- the destination vertexedge
- the edge to add- Returns:
- the
Set
containing the edge objects associated with the source and destination vertices
-
getDestinations
public Set<Object> getDestinations(Object source)
Given a source vertex, get all of the vertices which can be reached from that source.- Parameters:
source
- the source vertex- Returns:
- a
Set
of the destination vertices
-
getSources
public Set<Object> getSources(Object destination)
Given a destination vertex, get all of the vertices which are linked to that destination.- Parameters:
destination
- the destination vertex- Returns:
- a
Set
of the source vertices
-
getAllSources
public Set<Object> getAllSources()
Get aSet
containing all of the source vertices in this AdjacencyMap.- Returns:
- an immutable set containing the source vertices
-
getAllDestinations
public Set<Object> getAllDestinations()
Get aSet
containing all of the destination vertices in this AdjacencyMap.- Returns:
- an immutable set containing the destination vertices
-
removeAllWithDestination
public void removeAllWithDestination(Object destination)
Given a vertex, remove all entries in the AdjacencyMap which have this vertex as a destination.- Parameters:
destination
- the destination vertex
-
containsSource
public boolean containsSource(Object source)
Determines whether this AdjacencyMap contains the specified source vertex.- Parameters:
source
- the source vertex to query for- Returns:
true
if the adjacency map contains the source, otherwisefalse
-
containsDestination
public boolean containsDestination(Object destination)
Determines whether this AdjacencyMap contains the specified destination vertex.- Parameters:
destination
- the source vertex to query for- Returns:
true
if the adjacency map contains the destination, otherwisefalse
-
toStringFull
public String toStringFull()
-
-