Package edu.gsu.cs.dmlab.graph
Class LockGraph
-
- All Implemented Interfaces:
ITrackingGraph
,Serializable
,Cloneable
,org.jgrapht.DirectedGraph<String,Edge>
,org.jgrapht.Graph<String,Edge>
,org.jgrapht.WeightedGraph<String,Edge>
public class LockGraph extends org.jgrapht.graph.SimpleDirectedWeightedGraph<String,Edge> implements ITrackingGraph
This class is a wrapper for a simple directed weighted graph that provides locking on insert of new edges usingISTTrackingTrajectory
objects as the nodes. Kempton et. al. 2015 and 2018.- Author:
- Dustin Kempton, Data Mining Lab, Georgia State University
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LockGraph(Class<? extends Edge> edgeClass, ITrackingGraphProblemFactory factory, ISTEdgeWeightCalculator weightCalculator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAssociationPossibility(ISTTrackingTrajectory leftTrack, ISTTrackingTrajectory rightTrack)
Adds an association edge between the two tracks.boolean
addEdge(String sourceVertex, String targetVertex, Edge edge)
void
addTrackToGraph(ISTTrackingTrajectory track)
Adds the track to the graph by adding any vertices and edges from the source or to the sink that are used to represent the given track.boolean
containsTrack(ISTTrackingTrajectory track)
Returns whether this graph contains the vertices that represent the passed in track.void
finalize()
String
getSinkName()
Returns the name of the sink vertex for this graph.String
getSourceName()
Returns the name of the source vertex for this graph.ISTTrackingTrajectory
getTrackForVertex(String name)
Given the vertex name, this method returns the track that the vertex represents.boolean
moveTrackToGraph(ISTTrackingTrajectory track, ITrackingGraph graph)
This method moves the track passed in, and all those that are reachable from the passed in track, to the passed in graph.void
setEdgeWeight(Edge e, double weight)
-
Methods inherited from class org.jgrapht.graph.AbstractBaseGraph
addEdge, addVertex, clone, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, incomingEdgesOf, inDegreeOf, isAllowingLoops, isAllowingMultipleEdges, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeSetFactory, vertexSet
-
Methods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSets
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgrapht.DirectedGraph
incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf
-
Methods inherited from interface org.jgrapht.Graph
addEdge, addVertex, containsEdge, containsEdge, containsVertex, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex, vertexSet
-
-
-
-
Constructor Detail
-
LockGraph
public LockGraph(Class<? extends Edge> edgeClass, ITrackingGraphProblemFactory factory, ISTEdgeWeightCalculator weightCalculator)
-
-
Method Detail
-
finalize
public void finalize() throws Throwable
-
setEdgeWeight
public void setEdgeWeight(Edge e, double weight)
-
addTrackToGraph
public void addTrackToGraph(ISTTrackingTrajectory track)
Description copied from interface:ITrackingGraph
Adds the track to the graph by adding any vertices and edges from the source or to the sink that are used to represent the given track.- Specified by:
addTrackToGraph
in interfaceITrackingGraph
- Parameters:
track
- The track to insert into the graph.
-
getSinkName
public String getSinkName()
Description copied from interface:ITrackingGraph
Returns the name of the sink vertex for this graph.- Specified by:
getSinkName
in interfaceITrackingGraph
- Returns:
- The name of the sink vertex.
-
getSourceName
public String getSourceName()
Description copied from interface:ITrackingGraph
Returns the name of the source vertex for this graph.- Specified by:
getSourceName
in interfaceITrackingGraph
- Returns:
- The name of the source vertex.
-
getTrackForVertex
public ISTTrackingTrajectory getTrackForVertex(String name)
Description copied from interface:ITrackingGraph
Given the vertex name, this method returns the track that the vertex represents.- Specified by:
getTrackForVertex
in interfaceITrackingGraph
- Parameters:
name
- The vertex to get the track for.- Returns:
- The track that the vertex represents.
-
addAssociationPossibility
public boolean addAssociationPossibility(ISTTrackingTrajectory leftTrack, ISTTrackingTrajectory rightTrack)
Description copied from interface:ITrackingGraph
Adds an association edge between the two tracks. This assumes that the tracks are already in the graph.- Specified by:
addAssociationPossibility
in interfaceITrackingGraph
- Parameters:
leftTrack
- The track at an earlier time step.rightTrack
- The track at a later time step.- Returns:
- True if successful, false otherwise.
-
containsTrack
public boolean containsTrack(ISTTrackingTrajectory track)
Description copied from interface:ITrackingGraph
Returns whether this graph contains the vertices that represent the passed in track.- Specified by:
containsTrack
in interfaceITrackingGraph
- Parameters:
track
- Track to test for graph containment- Returns:
- True if the graph has the vertices that represent the passed in track. False otherwise.
-
moveTrackToGraph
public boolean moveTrackToGraph(ISTTrackingTrajectory track, ITrackingGraph graph)
Description copied from interface:ITrackingGraph
This method moves the track passed in, and all those that are reachable from the passed in track, to the passed in graph. It is not safe to call this method by passing in a pointer to the same graph that you are calling this method on. Just don't do it.- Specified by:
moveTrackToGraph
in interfaceITrackingGraph
- Parameters:
track
- The track to movegraph
- The graph to move to- Returns:
- True if successful, otherwise you will probably just lock up.
-
-