class_docstr: A sampling graph in CSC format.
class_docstr_tok: ["A","sampling","graph","in","CSC","format","."]
docstr: Return the subgraph induced on the inbound edges of the given nodes.
  
  An in subgraph is equivalent to creating a new graph using the incoming
  edges of the given nodes. Subgraph is compacted according to the order
  of passed-in `nodes`.
  
  Parameters
  ----------
  nodes: torch.Tensor or Dict[str, torch.Tensor]
      IDs of the given seed nodes.
        - If `nodes` is a tensor: It means the graph is homogeneous
          graph, and ids inside are homogeneous ids.
        - If `nodes` is a dictionary: The keys should be node type and
          ids inside are heterogeneous ids.
  
  Returns
  -------
  SampledSubgraphImpl
      The in subgraph.
  
  Examples
  --------
  >>> import dgl.graphbolt as gb
  >>> import torch
  >>> total_num_nodes = 5
  >>> total_num_edges = 12
  >>> ntypes = {"N0": 0, "N1": 1}
  >>> etypes = {
  ...     "N0:R0:N0": 0, "N0:R1:N1": 1, "N1:R2:N0": 2, "N1:R3:N1": 3}
  >>> indptr = torch.LongTensor([0, 3, 5, 7, 9, 12])
  >>> indices = torch.LongTensor([0, 1, 4, 2, 3, 0, 1, 1, 2, 0, 3, 4])
  >>> node_type_offset = torch.LongTensor([0, 2, 5])
  >>> type_per_edge = torch.LongTensor(
  ...     [0, 0, 2, 2, 2, 1, 1, 1, 3, 1, 3, 3])
  >>> graph = gb.fused_csc_sampling_graph(indptr, indices,
  ...     node_type_offset=node_type_offset,
  ...     type_per_edge=type_per_edge,
  ...     node_type_to_id=ntypes,
  ...     edge_type_to_id=etypes)
  >>> nodes = {"N0":torch.LongTensor([1]), "N1":torch.LongTensor([1, 2])}
  >>> in_subgraph = graph.in_subgraph(nodes)
  >>> print(in_subgraph.sampled_csc)
  {'N0:R0:N0': CSCFormatBase(indptr=tensor([0, 0]),
        indices=tensor([], dtype=torch.int64),
  ), 'N0:R1:N1': CSCFormatBase(indptr=tensor([0, 1, 2]),
              indices=tensor([1, 0]),
  ), 'N1:R2:N0': CSCFormatBase(indptr=tensor([0, 2]),
              indices=tensor([0, 1]),
  ), 'N1:R3:N1': CSCFormatBase(indptr=tensor([0, 1, 3]),
              indices=tensor([0, 1, 2]),
  )}
docstr_tok: ["Return","the","subgraph","induced","on","the","inbound","edges","of","the","given","nodes",".","An","in","subgraph","is","equivalent","to","creating","a","new","graph","using","the","incoming","edges","of","the","given","nodes",".","Subgraph","is","compacted","according","to","the","order","of","passed-in","`","nodes","`",".","Parameters","--","--","--","--","--","nodes",":","torch.Tensor","or","Dict","[","str",",","torch.Tensor","]","IDs","of","the","given","seed","nodes",".","-","If","`","nodes","`","is","a","tensor",":","It","means","the","graph","is","homogeneous","graph",",","and","ids","inside","are","homogeneous","ids",".","-","If","`","nodes","`","is","a","dictionary",":","The","keys","should","be","node","type","and","ids","inside","are","heterogeneous","ids",".","Returns","--","--","--","-","SampledSubgraphImpl","The","in","subgraph",".","Examples","--","--","--","--",">",">",">","import","dgl.graphbolt","as","gb",">",">",">","import","torch",">",">",">","total_num_nodes","=","5",">",">",">","total_num_edges","=","12",">",">",">","ntypes","=","{","``","N0","''",":","0",",","``","N1","''",":","1","}",">",">",">","etypes","=","{","...","``","N0",":","R0",":","N0","''",":","0",",","``","N0",":","R1",":","N1","''",":","1",",","``","N1",":","R2",":","N0","''",":","2",",","``","N1",":","R3",":","N1","''",":","3","}",">",">",">","indptr","=","torch.LongTensor","(","[","0",",","3",",","5",",","7",",","9",",","12","]",")",">",">",">","indices","=","torch.LongTensor","(","[","0",",","1",",","4",",","2",",","3",",","0",",","1",",","1",",","2",",","0",",","3",",","4","]",")",">",">",">","node_type_offset","=","torch.LongTensor","(","[","0",",","2",",","5","]",")",">",">",">","type_per_edge","=","torch.LongTensor","(","...","[","0",",","0",",","2",",","2",",","2",",","1",",","1",",","1",",","3",",","1",",","3",",","3","]",")",">",">",">","graph","=","gb.fused_csc_sampling_graph","(","indptr",",","indices",",","...","node_type_offset=node_type_offset",",","...","type_per_edge=type_per_edge",",","...","node_type_to_id=ntypes",",","...","edge_type_to_id=etypes",")",">",">",">","nodes","=","{","``","N0","''",":","torch.LongTensor","(","[","1","]",")",",","``","N1","''",":","torch.LongTensor","(","[","1",",","2","]",")","}",">",">",">","in_subgraph","=","graph.in_subgraph","(","nodes",")",">",">",">","print","(","in_subgraph.sampled_csc",")","{","'N0",":","R0",":","N0","'",":","CSCFormatBase","(","indptr=tensor","(","[","0",",","0","]",")",",","indices=tensor","(","[","]",",","dtype=torch.int64",")",",",")",",","'N0",":","R1",":","N1","'",":","CSCFormatBase","(","indptr=tensor","(","[","0",",","1",",","2","]",")",",","indices=tensor","(","[","1",",","0","]",")",",",")",",","'N1",":","R2",":","N0","'",":","CSCFormatBase","(","indptr=tensor","(","[","0",",","2","]",")",",","indices=tensor","(","[","0",",","1","]",")",",",")",",","'N1",":","R3",":","N1","'",":","CSCFormatBase","(","indptr=tensor","(","[","0",",","1",",","3","]",")",",","indices=tensor","(","[","0",",","1",",","2","]",")",",",")","}"]
code: def in_subgraph(
      self,
      nodes: Union[torch.Tensor, Dict[str, torch.Tensor]],
  ) -> SampledSubgraphImpl:
      """Return the subgraph induced on the inbound edges of the given nodes.
  
      An in subgraph is equivalent to creating a new graph using the incoming
      edges of the given nodes. Subgraph is compacted according to the order
      of passed-in `nodes`.
  
      Parameters
      ----------
      nodes: torch.Tensor or Dict[str, torch.Tensor]
          IDs of the given seed nodes.
            - If `nodes` is a tensor: It means the graph is homogeneous
              graph, and ids inside are homogeneous ids.
            - If `nodes` is a dictionary: The keys should be node type and
              ids inside are heterogeneous ids.
  
      Returns
      -------
      SampledSubgraphImpl
          The in subgraph.
  
      Examples
      --------
      >>> import dgl.graphbolt as gb
      >>> import torch
      >>> total_num_nodes = 5
      >>> total_num_edges = 12
      >>> ntypes = {"N0": 0, "N1": 1}
      >>> etypes = {
      ...     "N0:R0:N0": 0, "N0:R1:N1": 1, "N1:R2:N0": 2, "N1:R3:N1": 3}
      >>> indptr = torch.LongTensor([0, 3, 5, 7, 9, 12])
      >>> indices = torch.LongTensor([0, 1, 4, 2, 3, 0, 1, 1, 2, 0, 3, 4])
      >>> node_type_offset = torch.LongTensor([0, 2, 5])
      >>> type_per_edge = torch.LongTensor(
      ...     [0, 0, 2, 2, 2, 1, 1, 1, 3, 1, 3, 3])
      >>> graph = gb.fused_csc_sampling_graph(indptr, indices,
      ...     node_type_offset=node_type_offset,
      ...     type_per_edge=type_per_edge,
      ...     node_type_to_id=ntypes,
      ...     edge_type_to_id=etypes)
      >>> nodes = {"N0":torch.LongTensor([1]), "N1":torch.LongTensor([1, 2])}
      >>> in_subgraph = graph.in_subgraph(nodes)
      >>> print(in_subgraph.sampled_csc)
      {'N0:R0:N0': CSCFormatBase(indptr=tensor([0, 0]),
            indices=tensor([], dtype=torch.int64),
      ), 'N0:R1:N1': CSCFormatBase(indptr=tensor([0, 1, 2]),
                  indices=tensor([1, 0]),
      ), 'N1:R2:N0': CSCFormatBase(indptr=tensor([0, 2]),
                  indices=tensor([0, 1]),
      ), 'N1:R3:N1': CSCFormatBase(indptr=tensor([0, 1, 3]),
                  indices=tensor([0, 1, 2]),
      )}
      """
      if isinstance(nodes, dict):
          nodes = self._convert_to_homogeneous_nodes(nodes)
      # Ensure nodes is 1-D tensor.
      assert nodes.dim() == 1, "Nodes should be 1-D tensor."
      # Ensure that there are no duplicate nodes.
      assert len(torch.unique(nodes)) == len(
          nodes
      ), "Nodes cannot have duplicate values."
  
      _in_subgraph = self._c_csc_graph.in_subgraph(nodes)
      return self._convert_to_sampled_subgraph(_in_subgraph)
  
imports: from typing import Dict, Optional, Union
  import torch
  from dgl.utils import recursive_apply
  from ...base import EID, ETYPE, NID, NTYPE
  from ...convert import to_homogeneous
  from ...heterograph import DGLGraph
  from ..base import etype_str_to_tuple, etype_tuple_to_str, ORIGINAL_EDGE_ID
  from ..sampling_graph import SamplingGraph
  from .sampled_subgraph_impl import CSCFormatBase, SampledSubgraphImpl
label_desc: Use image node_id 24 for calling the FusedCSCSamplingGraph obj's underlying member method code with example usage: obj.in_subgraph(nodes) and returns: self