Modifier and Type | Method and Description |
---|---|
boolean |
containsEdge(Spot source,
Spot target)
Returns
true if this model contains the specified edge. |
<V> org.jgrapht.graph.SimpleDirectedWeightedGraph<V,org.jgrapht.graph.DefaultWeightedEdge> |
copy(Supplier<V> factory,
Function1<Spot,V> function,
Map<Spot,V> mappings)
Returns a new graph with the same structure as the one wrapped here, and
with vertices generated by the given
Function1 . |
List<org.jgrapht.graph.DefaultWeightedEdge> |
dijkstraShortestPath(Spot source,
Spot target)
Returns the shortest path between two connected spot, using Dijkstra's
algorithm.
|
String |
echo() |
Set<org.jgrapht.graph.DefaultWeightedEdge> |
edgeSet()
Returns a set of the edges contained in this model.
|
Set<org.jgrapht.graph.DefaultWeightedEdge> |
edgesOf(Spot spot)
Returns the set of edges of a spot.
|
void |
from(org.jgrapht.graph.SimpleWeightedGraph<Spot,org.jgrapht.graph.DefaultWeightedEdge> lGraph,
Map<Integer,Set<Spot>> trackSpots,
Map<Integer,Set<org.jgrapht.graph.DefaultWeightedEdge>> trackEdges,
Map<Integer,Boolean> trackVisibility,
Map<Integer,String> trackNames)
This method is meant to help building a model from a serialized source,
such as a saved file.
|
org.jgrapht.traverse.GraphIterator<Spot,org.jgrapht.graph.DefaultWeightedEdge> |
getDepthFirstIterator(Spot start,
boolean directed)
Returns a new depth first iterator over the spots connected by links in
this model.
|
TimeDirectedNeighborIndex |
getDirectedNeighborIndex() |
org.jgrapht.graph.DefaultWeightedEdge |
getEdge(Spot source,
Spot target)
Returns the specified edge.
|
Spot |
getEdgeSource(org.jgrapht.graph.DefaultWeightedEdge e)
Returns the source spot of the specified edge.
|
Spot |
getEdgeTarget(org.jgrapht.graph.DefaultWeightedEdge e)
Returns the target spot of the specified edge.
|
double |
getEdgeWeight(org.jgrapht.graph.DefaultWeightedEdge edge)
Returns the weight assigned to the specified edge.
|
SortedDepthFirstIterator<Spot,org.jgrapht.graph.DefaultWeightedEdge> |
getSortedDepthFirstIterator(Spot start,
Comparator<Spot> comparator,
boolean directed)
Returns a new depth first iterator over the spots connected by links in
this model.
|
boolean |
isVisible(Integer ID)
Returns
true if the track with the specified ID is marked as
visible, false otherwise. |
String |
name(Integer id)
Returns the name of the track with the specified ID.
|
int |
nTracks(boolean visibleOnly) |
void |
setName(Integer id,
String name)
Sets the name of the track with the specified ID.
|
Set<org.jgrapht.graph.DefaultWeightedEdge> |
trackEdges(Integer trackID)
Returns the edges of the track with the specified ID.
|
Integer |
trackIDOf(org.jgrapht.graph.DefaultWeightedEdge edge)
Returns the track ID the specified edge belong to, or
null
if the specified edge cannot be found in this model. |
Integer |
trackIDOf(Spot spot)
Returns the track ID the specified spot belong to, or
null
if the specified spot cannot be found in this model. |
Set<Integer> |
trackIDs(boolean visibleOnly)
Returns the set of track IDs managed by this model, ordered by track
names (alpha-numerically sorted).
|
Set<Spot> |
trackSpots(Integer trackID)
Returns the spots of the track with the specified ID.
|
Set<Integer> |
unsortedTrackIDs(boolean visibleOnly)
Returns the set of track IDs managed by this model, unsorted.
|
Set<Spot> |
vertexSet()
Returns a set of the vertices contained in this graph.
|
public void from(org.jgrapht.graph.SimpleWeightedGraph<Spot,org.jgrapht.graph.DefaultWeightedEdge> lGraph, Map<Integer,Set<Spot>> trackSpots, Map<Integer,Set<org.jgrapht.graph.DefaultWeightedEdge>> trackEdges, Map<Integer,Boolean> trackVisibility, Map<Integer,String> trackNames)
It is the caller responsibility to ensure that the graph and provided component are coherent. Unexpected behavior might result otherwise.
lGraph
- the mother graph for the model.trackSpots
- the mapping of track IDs vs the connected components as sets
of spots.trackEdges
- the mapping of track IDs vs the connected components as sets
of edges.trackVisibility
- the track visibility.trackNames
- the track names.public <V> org.jgrapht.graph.SimpleDirectedWeightedGraph<V,org.jgrapht.graph.DefaultWeightedEdge> copy(Supplier<V> factory, Function1<Spot,V> function, Map<Spot,V> mappings)
Function1
. Edges are copied
in direction and weight.V
- the type of the vertices.factory
- the vertex factory used to instantiate new vertices in the new
graphfunction
- the function used to set values of a new vertex in the new
graph, from the matching spotmappings
- a map that will receive mappings from Spot
to the new
vertices. Can be null
if you do not want to get
the mappingsSimpleDirectedWeightedGraph
.public boolean containsEdge(Spot source, Spot target)
true
if this model contains the specified edge.source
- the edge source vertex.target
- the edge target vertex.true
if this model contains the specified edge.Graph.containsEdge(Object, Object)
public org.jgrapht.graph.DefaultWeightedEdge getEdge(Spot source, Spot target)
source
- the edge source vertex.target
- the edge target vertex.null
if it does not exist.Graph.getEdge(Object, Object)
public Set<org.jgrapht.graph.DefaultWeightedEdge> edgesOf(Spot spot)
spot
- the spot.Graph.edgesOf(Object)
public Set<org.jgrapht.graph.DefaultWeightedEdge> edgeSet()
Graph.edgeSet()
public Set<Spot> vertexSet()
Graph.vertexSet()
public Spot getEdgeSource(org.jgrapht.graph.DefaultWeightedEdge e)
e
- the edge.Graph.getEdgeSource(Object)
public Spot getEdgeTarget(org.jgrapht.graph.DefaultWeightedEdge e)
e
- the edge.Graph.getEdgeTarget(Object)
public double getEdgeWeight(org.jgrapht.graph.DefaultWeightedEdge edge)
edge
- the edge.Graph.getEdgeWeight(Object)
public boolean isVisible(Integer ID)
true
if the track with the specified ID is marked as
visible, false
otherwise. Throws a
NullPointerException
if the track ID is unknown to this model.ID
- the track ID.public Set<Integer> trackIDs(boolean visibleOnly)
visibleOnly
- if true
, only visible track IDs will be returned.public Set<Integer> unsortedTrackIDs(boolean visibleOnly)
visibleOnly
- if true
, only visible track IDs will be returned.public String name(Integer id)
id
- the track ID.public void setName(Integer id, String name)
id
- the track ID.name
- the name for the track.public Set<org.jgrapht.graph.DefaultWeightedEdge> trackEdges(Integer trackID)
trackID
- the track ID.public Set<Spot> trackSpots(Integer trackID)
trackID
- the track ID.public int nTracks(boolean visibleOnly)
public Integer trackIDOf(org.jgrapht.graph.DefaultWeightedEdge edge)
null
if the specified edge cannot be found in this model.edge
- the edge to search for.public Integer trackIDOf(Spot spot)
null
if the specified spot cannot be found in this model.spot
- the spot to search for.public String echo()
public org.jgrapht.traverse.GraphIterator<Spot,org.jgrapht.graph.DefaultWeightedEdge> getDepthFirstIterator(Spot start, boolean directed)
start
- the spot to start iteration with. Can be null
,
then the start will be taken randomly and will traverse all
the links.directed
- if true returns a directed iterator, undirected if false.public SortedDepthFirstIterator<Spot,org.jgrapht.graph.DefaultWeightedEdge> getSortedDepthFirstIterator(Spot start, Comparator<Spot> comparator, boolean directed)
start
- the spot to start iteration with. Can be null
,
then the start will be taken randomly and will traverse all
the links.directed
- if true returns a directed iterator, undirected if false.comparator
- the comparator to use to pick children in order when
branching.public TimeDirectedNeighborIndex getDirectedNeighborIndex()
public List<org.jgrapht.graph.DefaultWeightedEdge> dijkstraShortestPath(Spot source, Spot target)
Returns null
if the two spots are not connected by a track,
or if one of the spot do not belong to the graph, or if the graph field
is null
.
source
- the spot to start the path withtarget
- the spot to stop the path withCopyright © 2015–2021 Fiji. All rights reserved.