Knowledge Graph 25.4
Knowledge Graph Reference

# GetShortestPaths

Returns the specified number of shortest paths to or from the specified input node. For example, you can use this action to find all target nodes within a specified distance of the input node, and the fastest path to get to them.

You must provide the name or ID of one node, which can be a source node or a target node. If you specify a source node, the action returns the shortest paths away from that node. If you specify a target node, the action returns the shortest paths that end on that node.

You can use MaxDistance and MaxResults to specify the number of result paths to find.

- MaxDistance specifies the maximum length of path to return. You can use Method to specify how to calculate the distance between nodes.
- MaxResults specifies the maximum number of paths.

If you set both MaxDistance and MaxResults, the action uses whichever value gives the smallest number of result nodes.

## Example

    http://12.3.4.56:10300/action=GetShortestPaths&SourceName=alice%40example.com&MaxDistance=5

This action finds five shortest paths in your graph from the node `alice@example.com`.

## Parameters

Parameter | Description | Required
--- | --- | ---
MaxDistance | The maximum distance or length that a path can have from the specified node. |
MaxResults | The maximum number of paths to return. |
Method | The method to use to determine the distance between nodes. | Yes
SourceID | The ID of the source node for the path. | See Comments
SourceName | The name of the source node for the path. | See Comments
TargetID | The ID of the target node for the path. | See Comments
TargetName | The name of the target node for the path. | See Comments

## Comments

You must specify one of SourceName, SourceID, TargetName, and TargetID.

Copyright 2025 Open Text
Version 25.4 | Last updated October 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Knowledge Graph 25.4

Topic Title: GetShortestPaths