Knowledge Graph 12.13

# GetNeighborhood

Returns the closest nodes to a specified set of input nodes, and all edges between the set of nodes. This action allows you to create a subgraph around a set of input nodes, and all nodes within a specified distance of those input nodes. This action can help you to get a picture of what the graph is like around the nodes that you are interested in, and can be useful for visualizations.

You must set one of NodeNames and NodeIDs to specify the nodes that you want to start from. These nodes do not need to be connected to each other.

You can specify the number of nodes to return by setting MaxResults or MaxDistance.

- MaxResults specifies the number of nodes to return, in addition to the input nodes.
- MaxDistance specifies the maximum distance that a node can have from one of the input nodes to return. That is, a node must be within this distance of at least one of your input nodes to return as a result node. You can use Method to specify how to calculate the distance between nodes.

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

For the `GetNeighborhood` action, the distance between two nodes does not consider the direction of any edges. For example, if you specify `node1`, which has an edge of length 2 pointing to it from `node2`, the action gives `node2` a distance of 2, even though there is no direct route from `node1` to `node2`.

## Example

    http://12.3.4.56:10300/action=GetNeighborhood&NodeNames=grace%40example.com,jason%40example.com&MaxResults=20

This action returns up to 20 nodes that are closest to the nodes `grace@example.com` and `jason@example.com` in the graph.

## Parameters

Parameter | Description | Required
--- | --- | ---
MaxDistance | The maximum distance from the specified start nodes that a node can have to return as a result. |
MaxResults | The maximum number of neighboring nodes to return. |
Method | The method to use to determine the distance between nodes. | Yes
NodeNames | The names of the nodes that you want to use as the starting point for the neighborhood. | See Comments.
NodeIDs | The IDs of the nodes that you want to use as the starting point for the neighborhood. | See Comments.

## Comments

You must set one of NodeNames and NodeIDs to specify the nodes that you want to start from.

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.13 | Last updated October 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Knowledge Graph 12.13

Topic Title: GetNeighborhood