Class DynamicOneToAllShortestPath
java.lang.Object
org.graphstream.stream.SinkAdapter
org.graphstream.algorithm.networksimplex.NetworkSimplex
org.graphstream.algorithm.networksimplex.DynamicOneToAllShortestPath
- All Implemented Interfaces:
Algorithm
,DynamicAlgorithm
,org.graphstream.stream.AttributeSink
,org.graphstream.stream.ElementSink
,org.graphstream.stream.Sink
public class DynamicOneToAllShortestPath extends NetworkSimplex
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.algorithm.networksimplex.NetworkSimplex
NetworkSimplex.ArcStatus, NetworkSimplex.PricingStrategy, NetworkSimplex.SolutionStatus
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DynamicOneToAllShortestPath(String costName)
-
Method Summary
Modifier and Type Method Description org.graphstream.graph.Path
getPath(org.graphstream.graph.Node target)
Returns the shortest path from the source node to a given target node.<T extends org.graphstream.graph.Edge>
Iterable<org.graphstream.graph.Edge>getPathEdges(org.graphstream.graph.Node target)
An iterable view of the edges on the shortest path from the source node to a given target node.<T extends org.graphstream.graph.Edge>
Iterator<org.graphstream.graph.Edge>getPathEdgesIterator(org.graphstream.graph.Node target)
This iterator traverses the edges on the shortest path from the source node to a given target node.long
getPathLength(org.graphstream.graph.Node node)
<T extends org.graphstream.graph.Node>
Iterable<org.graphstream.graph.Node>getPathNodes(org.graphstream.graph.Node target)
An iterable view of the nodes on the shortest path from the source node to a given target node.<T extends org.graphstream.graph.Node>
Iterator<org.graphstream.graph.Node>getPathNodesIterator(org.graphstream.graph.Node target)
This iterator traverses the nodes on the shortest path from the source node to a given target node.String
getSource()
void
init(org.graphstream.graph.Graph graph)
Initialization of the algorithm.void
nodeAdded(String sourceId, long timeId, String nodeId)
void
nodeRemoved(String sourceId, long timeId, String nodeId)
void
setSource(String sourceId)
Methods inherited from class org.graphstream.algorithm.networksimplex.NetworkSimplex
compute, edgeAdded, edgeAttributeAdded, edgeAttributeChanged, edgeAttributeRemoved, edgeRemoved, getCapacityName, getCostName, getEdgeFromParent, getFlow, getFlow, getGraph, getInfeasibility, getNetworkBalance, getParent, getPricingStrategy, getSolutionCost, getSolutionInfeasibility, getSolutionStatus, getStatus, getStatus, getSupplyName, graphCleared, nodeAttributeAdded, nodeAttributeChanged, nodeAttributeRemoved, printBFS, setAnimationDelay, setLogFrequency, setLogStream, setPricingStrategy, setUIClasses, terminate
-
Constructor Details
-
Method Details
-
getSource
-
setSource
-
init
public void init(org.graphstream.graph.Graph graph)Description copied from interface:Algorithm
Initialization of the algorithm. This method has to be called before theAlgorithm.compute()
method to initialize or reset the algorithm according to the new given graph.- Specified by:
init
in interfaceAlgorithm
- Overrides:
init
in classNetworkSimplex
- Parameters:
graph
- The graph this algorithm is using.
-
nodeAdded
- Specified by:
nodeAdded
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
nodeAdded
in classNetworkSimplex
-
nodeRemoved
- Specified by:
nodeRemoved
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
nodeRemoved
in classNetworkSimplex
-
getPathLength
public long getPathLength(org.graphstream.graph.Node node) -
getPathNodesIterator
public <T extends org.graphstream.graph.Node> Iterator<org.graphstream.graph.Node> getPathNodesIterator(org.graphstream.graph.Node target)This iterator traverses the nodes on the shortest path from the source node to a given target node. The nodes are traversed in reverse order: the target node first, then its predecessor, ... and finally the source node. If there is no path from the source to the target, no nodes are traversed. This iterator does not supportIterator.remove()
.- Parameters:
target
- a node- Returns:
- an iterator on the nodes of the shortest path from the source to the target
- See Also:
getPathNodes(Node)
- Computational Complexity :
- Each call of
Iterator.next()
of this iterator takes O(1) time
-
getPathNodes
public <T extends org.graphstream.graph.Node> Iterable<org.graphstream.graph.Node> getPathNodes(org.graphstream.graph.Node target)An iterable view of the nodes on the shortest path from the source node to a given target node. UsesgetPathNodesIterator(Node)
.- Parameters:
target
- a node- Returns:
- an iterable view of the nodes on the shortest path from the source to the target
- See Also:
getPathNodesIterator(Node)
-
getPathEdgesIterator
public <T extends org.graphstream.graph.Edge> Iterator<org.graphstream.graph.Edge> getPathEdgesIterator(org.graphstream.graph.Node target)This iterator traverses the edges on the shortest path from the source node to a given target node. The edges are traversed in reverse order: first the edge between the target and its predecessor, ... and finally the edge between the source end its successor. If there is no path from the source to the target or if he source and the target are the same node, no edges are traversed. This iterator does not supportIterator.remove()
.- Parameters:
target
- a node- Returns:
- an iterator on the edges of the shortest path from the source to the target
- See Also:
getPathEdges(Node)
- Computational Complexity :
- Each call of
Iterator.next()
of this iterator takes O(1) time
-
getPathEdges
public <T extends org.graphstream.graph.Edge> Iterable<org.graphstream.graph.Edge> getPathEdges(org.graphstream.graph.Node target)An iterable view of the edges on the shortest path from the source node to a given target node. UsesgetPathEdgesIterator(Node)
.- Parameters:
target
- a node- Returns:
- an iterable view of the edges on the shortest path from the source to the target
- See Also:
getPathEdgesIterator(Node)
-
getPath
public org.graphstream.graph.Path getPath(org.graphstream.graph.Node target)Returns the shortest path from the source node to a given target node. If there is no path from the source to the target returns an empty path. This method constructs aPath
object which consumes heap memory proportional to the number of edges and nodes in the path. When possible, prefer usinggetPathNodes(Node)
andgetPathEdges(Node)
which are more memory- and time-efficient.- Parameters:
target
- a node- Returns:
- the shortest path from the source to the target
- Computational Complexity :
- O(p) where p is the number of the nodes in the path
-