Class GraphDistancesImpl
java.lang.Object
it.univr.di.cstnu.util.GraphDistancesImpl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getDistance
(LabeledNode source, LabeledNode destination) it.unimi.dsi.fastutil.objects.ObjectSet
<LabeledNode> getNodes()
it.unimi.dsi.fastutil.objects.Object2IntMap
<LabeledNode> getReachable
(LabeledNode node) void
putDistance
(LabeledNode source, LabeledNode destination, int distance) Sets the new distance between source node and destination one.void
putDistances
(LabeledNode source, it.unimi.dsi.fastutil.objects.Object2IntMap<LabeledNode> destinations) Sets the new distance between source node and all destination nodes in destinations.void
removeDistance
(LabeledNode source, LabeledNode destination) Remove the distance between source node and destination one.toString()
-
Constructor Details
-
GraphDistancesImpl
public GraphDistancesImpl()Default constructor
-
-
Method Details
-
getDistance
- Specified by:
getDistance
in interfaceGraphDistances
- Parameters:
source
- the source nodedestination
- the destination node- Returns:
- the distance between source node and destination one if a finite distance exists, +∞ otherwise
-
getNodes
- Specified by:
getNodes
in interfaceGraphDistances
- Returns:
- the source nodes present in the matrix if any, empty list otherwise.
-
getReachable
public it.unimi.dsi.fastutil.objects.Object2IntMap<LabeledNode> getReachable(@Nonnull LabeledNode node) - Specified by:
getReachable
in interfaceGraphDistances
- Parameters:
node
- the node- Returns:
- the map (node, distance) of nodes reachable from 'node' if there are any, empty set otherwise.
-
putDistance
public void putDistance(@Nonnull LabeledNode source, @Nonnull LabeledNode destination, int distance) Description copied from interface:GraphDistances
Sets the new distance between source node and destination one.- Specified by:
putDistance
in interfaceGraphDistances
- Parameters:
source
- the source node.destination
- the destination node.distance
- the new distance between source and destination.
-
putDistances
public void putDistances(@Nonnull LabeledNode source, @Nonnull it.unimi.dsi.fastutil.objects.Object2IntMap<LabeledNode> destinations) Description copied from interface:GraphDistances
Sets the new distance between source node and all destination nodes in destinations. All previous nodes reachable by source are removed.- Specified by:
putDistances
in interfaceGraphDistances
- Parameters:
source
- the source node.destinations
- a map of all (reachable destination, distance) from source node.
-
removeDistance
Description copied from interface:GraphDistances
Remove the distance between source node and destination one.- Specified by:
removeDistance
in interfaceGraphDistances
- Parameters:
source
- the source nodedestination
- the destination node
-
toString
-