Class PotentialBasedShortestDistanceFinder
An IPotentialBasedShortestDistanceFinder implementation, wrapping a IShortestDistanceFinder algorithm and using a potential function as a heuristic to enhance graph exploration.
Inheritance
Inherited Members
Namespace: MoreStructures.Graphs.ShortestDistance
Assembly: MoreStructures.dll
Syntax
public abstract class PotentialBasedShortestDistanceFinder : IPotentialBasedShortestDistanceFinder, IShortestDistanceFinder
Remarks
Common ground for all A* variants, such as AStarShortestDistanceFinder and
BidirectionalAStarShortestDistanceFinder.
Check IPotentialBasedShortestDistanceFinder general documentation for the requirements and desired
properties for the heuristic.
Constructors
| Improve this Doc View SourcePotentialBasedShortestDistanceFinder(IShortestDistanceFinder)
Declaration
protected PotentialBasedShortestDistanceFinder(IShortestDistanceFinder finder)
Parameters
Type | Name | Description |
---|---|---|
IShortestDistanceFinder | finder |
Properties
| Improve this Doc View SourceFinder
A IShortestDistanceFinder instance, used to run the shortest distance algorithm on the provided graph.
Declaration
protected IShortestDistanceFinder Finder { get; }
Property Value
Type | Description |
---|---|
IShortestDistanceFinder |
Methods
| Improve this Doc View SourceFind(IGraph, IGraphDistances, Func<Int32, Int32>, Int32, Int32)
Finds the shortest distance and path in the provided graph
from the start
vertex to the end
vertex, i.e. a path such that the sum of distances of all the edges on the
path is non-bigger than the one of any other path from the provided start
and
end
vertices
Declaration
public (int, IList<int>) Find(IGraph graph, IGraphDistances distances, Func<int, int> potentials, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
IGraph | graph | |
IGraphDistances | distances | |
Func<System.Int32, System.Int32> | potentials | A function mapping each vertex of the provided graph to a System.Int32, providing an heuristic for
"how far" the vertex is from the end vertex, to drive the IPotentialBasedShortestDistanceFinder
towards an earlier, rather than late, discovery of the end vertex.
|
System.Int32 | start | |
System.Int32 | end |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int32, IList<System.Int32>> | A couple. The first item of the couple is the shortest distance, as the sum of the distance of each edge of the
shortest path between |
Find(IGraph, IGraphDistances, Int32, Int32)
Finds the shortest distance and path in the provided graph
from the start
vertex to the end
vertex, i.e. a path such that the sum of distances of all the edges on the
path is non-bigger than the one of any other path from the provided start
and
end
vertices
Declaration
public (int, IList<int>) Find(IGraph graph, IGraphDistances distances, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
IGraph | graph | The graph to traverse. |
IGraphDistances | distances | A map between each edge of |
System.Int32 | start | The id of the vertex, to start traversal from. |
System.Int32 | end | The id of the vertex, to end traversal at. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int32, IList<System.Int32>> | A couple. The first item of the couple is the shortest distance, as the sum of the distance of each edge of the
shortest path between |