calculates all-pairs shortest paths or shortest paths from a single node
Calculator
Type Parameters
| Name | Description |
|---|---|
Link |
01 Syntax
Microsoft.VisualBasic.Data.GraphTheory.Analysis.Dijkstra.Calculator`1
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 1 | |
| DistanceMatrix | 1 | compute shortest paths for graph over n nodes with edges an array of source/target pairs edges may optionally have a length attribute. |
| DistancesFromNode | 1 | get shortest paths from a specified start node |
| PathFromNodeToNodeWithPrevCost | 1 | find shortest path from start to end, with the opportunity at each edge traversal to compute a custom cost based on the previous edge. |
| PathFromNodeToNode | 1 |
03 Fields
04 Members
#ctor(
Int32, IEnumerable(Of `0), Func(Of `0, Double), Func(Of `0, Double), Func(Of `0, Double))Parameters
| Name | Type | Description |
|---|---|---|
n | Int32 | number of nodes |
es | IEnumerable(Of `0) | array of edges |
getSourceIndex | Func(Of `0, Double) | - |
getTargetIndex | Func(Of `0, Double) | - |
getLength | Func(Of `0, Double) | - |
DistanceMatrix
compute shortest paths for graph over n nodes with edges an array of source/target pairs edges may optionally have a length attribute. 1 is the default. Uses Johnson's algorithm.
Returns
return the distance matrix
DistancesFromNode(
Int32)get shortest paths from a specified start node
Parameters
| Name | Type | Description |
|---|---|---|
start | Int32 | start node index |
Returns
array of path lengths
PathFromNodeToNodeWithPrevCost(
Int32, Int32, Func(Of Int32, Int32, Int32, Double))find shortest path from start to end, with the opportunity at each edge traversal to compute a custom cost based on the previous edge. For example, to penalise bends.
Parameters
| Name | Type | Description |
|---|---|---|
start | Int32 | - |
[end] | Int32 | - |
prevCost | Func(Of Int32, Int32, Int32, Double) | - |
n
es
PathFromNodeToNode(
Int32, Int32)