Class AdjacencyMap
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.graph.adjacency.AdjacencyMap
-
public class AdjacencyMap extends Object
AnAdjacencyMapis 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 booleancontainsDestination(Object destination)Determines whether this AdjacencyMap contains the specified destination vertex.booleancontainsSource(Object source)Determines whether this AdjacencyMap contains the specified source vertex.Set<Object>getAllDestinations()Get aSetcontaining all of the destination vertices in this AdjacencyMap.Set<Object>getAllSources()Get aSetcontaining 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.voidremoveAllWithDestination(Object destination)Given a vertex, remove all entries in the AdjacencyMap which have this vertex as a destination.StringtoString()StringtoStringFull()
-
-
-
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
Setof 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- theSetof 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
Setcontaining 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
Setof 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
Setof the source vertices
-
getAllSources
public Set<Object> getAllSources()
Get aSetcontaining all of the source vertices in this AdjacencyMap.- Returns:
- an immutable set containing the source vertices
-
getAllDestinations
public Set<Object> getAllDestinations()
Get aSetcontaining 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:
trueif 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:
trueif the adjacency map contains the destination, otherwisefalse
-
toStringFull
public String toStringFull()
-
-