UltipaDocs
Try Playground
  • Introduction
    • Show Algorithms
    • Install and Uninstall
    • Run Algorithms
    • Algorithm Results and Statistics
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Graph Centrality
    • Betweenness Centrality
    • Eigenvector Centrality
    • CELF
    • PageRank
    • ArticleRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • K-Hop All
    • Bipartite Graph
    • HyperANF
    • Connected Component
    • Triangle Counting
    • Induced Subgraph
    • k-Core
    • k-Truss
    • p-Cohesion
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Topological Sort
    • Schema Overview
    • Dijkstra's Single-Source Shortest Path
    • Delta-Stepping Single-Source Shortest Path
    • Shortest Path Faster Algorithm (SPFA)
    • Minimum Spanning Tree
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Louvain
    • Leiden
    • Label Propagation
    • HANP
    • k-Means
    • kNN (k-Nearest Neighbors)
    • K-1 Coloring
    • Conductance
      • Random Walk
      • Node2Vec Walk
      • Node2Vec
      • Struc2Vec Walk
      • Struc2Vec
      • GraphSAGE
      • GraphSAGE Train
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Analytics & Algorithms
  4. /
  5. Connectivity & Compactness

Induced Subgraph

✓ File Writeback ✕ Property Writeback ✓ Direct Return ✓ Stream Return ✕ Stats

Overview

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.

Concepts

Induced Subgraph

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.

Considerations

  • The Induced Subgraph algorithm ignores the direction of edges but calculates them as undirected edges.

Syntax

  • Command: algo(subgraph)
  • Parameters:
Name
Type
Spec
Default
Optional
Description
ids / uuids[]_id / []_uuid//NoID/UUID of the nodes to calculate
limitint≥-1-1YesNumber of results to return, -1 to return all results

Examples

The example graph is as follows:

File Writeback

Spec
Content
Description
filename_id--[_uuid]--_idOne-step path in the induced subgraph:
(start node)--(edge)--(end node)
UQL
algo(subgraph).params({
  ids: ['A','C','D','G']
}).write({
  file:{
    filename: 'paths'
    }
})

Results: File paths

File
C--[102]--A
C--[105]--D
D--[107]--A
D--[106]--A
G--[109]--G

Direct Return

Alias Ordinal
Type
Description
0[]pathOne-step path in the induced subgraph:
_uuid (start node) -- [_uuid] (edge) -- _uuid (end node)
UQL
algo(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

Stream Return

Alias Ordinal
Type
Description
0[]pathOne-step path in the induced subgraph:
_uuid (start node) -- [_uuid] (edge) -- _uuid (end node)
UQL
algo(subgraph).params({
  uuids: [6,7]
}).stream() as p
with pedges(p) as e
find().edges(e) as edges
return max(edges.score)

Results: 5