The Induced Subgraph algorithm is used to compute the induced subgraph of a given set of nodes in a graph. It provides a way to focus on the immediate connections and gain insights into the local structure and interactions within the selected subset of nodes.
An induced subgraph includes only the nodes from the given set and the edges that connect those nodes.

As this example shows, when specifying node set S = {A, B, I, K, L, M, N}, the induced subgraph is the graph whose node set is S and whose edge set contains all edges that have both endpoints in S.
Ultipa's Induced Subgraph algorithm returns all the 1-step paths in the induced subgraph.
algo(subgraph)Name | Type | Spec | Default | Optional | Description |
|---|---|---|---|---|---|
| ids / uuids | []_id / []_uuid | / | / | No | ID/UUID of the nodes to calculate |
| limit | int | ≥-1 | -1 | Yes | Number of results to return, -1 to return all results |
The example graph is as follows:

Spec | Content | Description |
|---|---|---|
| filename | _id--[_uuid]--_id | One-step path in the induced subgraph: (start node)--(edge)--(end node) |
UQLalgo(subgraph).params({ ids: ['A','C','D','G'] }).write({ file:{ filename: 'paths' } })
Results: File paths
FileC--[102]--A C--[105]--D D--[107]--A D--[106]--A G--[109]--G
Alias Ordinal | Type | Description |
|---|---|---|
| 0 | []path | One-step path in the induced subgraph: _uuid (start node) -- [_uuid] (edge) -- _uuid (end node) |
UQLalgo(subgraph).params({ ids: ['A','C','D','G'] }) as subgraph return subgraph
Results: subgraph
| 3--[102]--1 |
| 3--[105]--4 |
| 4--[107]--1 |
| 4--[106]--1 |
| 7--[109]--7 |
Alias Ordinal | Type | Description |
|---|---|---|
| 0 | []path | One-step path in the induced subgraph: _uuid (start node) -- [_uuid] (edge) -- _uuid (end node) |
UQLalgo(subgraph).params({ uuids: [6,7] }).stream() as p with pedges(p) as e find().edges(e) as edges return max(edges.score)
Results: 5