dgl.distributed.in_subgraph(g, nodes)[source]

Return the subgraph induced on the inbound edges of the given nodes.

The subgraph keeps the same type schema and all the nodes are preserved regardless of whether they have an edge or not.

Node/edge features are not preserved. The original IDs of the extracted edges are stored as the dgl.EID feature in the returned graph.

For now, we only support the input graph with one node type and one edge type.

  • g (DistGraph) – The distributed graph structure.

  • nodes (tensor or dict) – Node ids to sample neighbors from.


The subgraph.

One can retrieve the mapping from subgraph edge ID to parent edge ID via dgl.EID edge features of the subgraph.

Return type: