algo.SSpaths procedure returns all shortest paths from a source node to multiple reachable nodes, subject to constraints like cost, path length, and number of paths to return.
Syntax
Parameters
Returns
Examples
Let’s take this Road Network Graph as an example:
Example: All Shortest Paths by Distance (up to 10 km)
Expected Result:
Example: Top 5 Shortest Paths from A by Distance
Expected Result:
Frequently Asked Questions
How does algo.SSpaths differ from algo.SPpaths?
How does algo.SSpaths differ from algo.SPpaths?
algo.SSpaths finds paths from a single source to multiple destinations (all reachable nodes). algo.SPpaths finds paths between a specific source-target pair. Use SSpaths for exploration and SPpaths for point-to-point routing.
Can I limit how many paths are returned?
Can I limit how many paths are returned?
Yes. Use the
pathCount parameter. Set it to a specific number (e.g. pathCount: 5) for the top results, or 0 to return all shortest paths.How do I constrain path results by distance or cost?
How do I constrain path results by distance or cost?
Use
maxCost with costProp to set an upper bound. For example, costProp: 'dist', maxCost: 10 returns only paths with total distance ≤ 10.What does the maxLen parameter do?
What does the maxLen parameter do?
It limits the maximum number of relationships (hops) in any returned path. This prevents very long paths from being explored, improving performance on dense graphs.
Is weightProp required?
Is weightProp required?
No. If omitted, all edges are treated as having equal weight. The algorithm then finds paths with the fewest hops rather than minimal weighted distance.