Shortest Path
Overview
The Shortest Path algorithm is used to find the shortest path between two nodes in a graph.
Application Scenarios
This algorithm applies to scenarios such as path design and network planning.
Parameter Description
Parameter |
Mandatory |
Description |
Type |
Value Range |
Default Value |
---|---|---|---|---|---|
source |
Yes |
Enter the source ID of a path. |
String |
- |
- |
target |
Yes |
Enter the target ID of a path. |
String |
- |
- |
directed |
No |
Whether an edge is directed |
Bool |
true or false |
false |
weight |
No |
Weight of an edge |
String |
Empty or null character string
|
- |
timeWindow |
No |
Time window used for time filtering |
Json |
For details, see Table 2.
NOTE:
timeWindow does not support the shortest path with weight. That is, parameters timeWindow and weight cannot be both specified. |
- |
Parameter |
Mandatory |
Description |
Type |
Value Range |
Default Value |
---|---|---|---|---|---|
filterName |
Yes |
Name of the time attribute used for time filtering |
String |
Character string: The attribute on the corresponding vertex/edge is used as the time. |
- |
filterType |
No |
Filtering by vertex or edge |
String |
V: Filtering by vertex E: Filtering by edge BOTH: Filtering by vertex and edge |
BOTH |
startTime |
No |
Start time |
String |
Date character string or timestamp |
- |
endTime |
No |
End time |
String |
Date character string or timestamp |
- |
Precautions
This algorithm only returns one shortest path.
Example
Calculate the shortest path from the Lee node to the Alice node.
Set parameters source to Lee, target to Alice, weight to weights, and directed to false. The shortest path is displayed on the canvas, and the JSON result is displayed in the result area.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.