class_docstr: Clusters/partitions a graph data object into multiple subgraphs, as
  motivated by the `"Cluster-GCN: An Efficient Algorithm for Training Deep
  and Large Graph Convolutional Networks"
  <https://arxiv.org/abs/1905.07953>`_ paper.
  
  .. note::
      The underlying METIS algorithm requires undirected graphs as input.
  
  Args:
      data (torch_geometric.data.Data): The graph data object.
      num_parts (int): The number of partitions.
      recursive (bool, optional): If set to :obj:`True`, will use multilevel
          recursive bisection instead of multilevel k-way partitioning.
          (default: :obj:`False`)
      save_dir (str, optional): If set, will save the partitioned data to the
          :obj:`save_dir` directory for faster re-use. (default: :obj:`None`)
      log (bool, optional): If set to :obj:`False`, will not log any
          progress. (default: :obj:`True`)
      keep_inter_cluster_edges (bool, optional): If set to :obj:`True`,
          will keep inter-cluster edge connections. (default: :obj:`False`)
      sparse_format (str, optional): The sparse format to use for computing
          partitions. (default: :obj:`"csr"`)
class_docstr_tok: ["Clusters\/partitions","a","graph","data","object","into","multiple","subgraphs",",","as","motivated","by","the","`","``","Cluster-GCN",":","An","Efficient","Algorithm","for","Training","Deep","and","Large","Graph","Convolutional","Networks","''","<","https",":","\/\/arxiv.org\/abs\/1905.07953",">","`","_","paper",".","..","note",":",":","The","underlying","METIS","algorithm","requires","undirected","graphs","as","input",".","Args",":","data","(","torch_geometric.data.Data",")",":","The","graph","data","object",".","num_parts","(","int",")",":","The","number","of","partitions",".","recursive","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","use","multilevel","recursive","bisection","instead","of","multilevel","k-way","partitioning",".","(","default",":",":","obj",":","`","False","`",")","save_dir","(","str",",","optional",")",":","If","set",",","will","save","the","partitioned","data","to","the",":","obj",":","`","save_dir","`","directory","for","faster","re-use",".","(","default",":",":","obj",":","`","None","`",")","log","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","False","`",",","will","not","log","any","progress",".","(","default",":",":","obj",":","`","True","`",")","keep_inter_cluster_edges","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","keep","inter-cluster","edge","connections",".","(","default",":",":","obj",":","`","False","`",")","sparse_format","(","str",",","optional",")",":","The","sparse","format","to","use","for","computing","partitions",".","(","default",":",":","obj",":","`","``","csr","''","`",")"]
code: def __getitem__(self, idx: int) -> Data:
      node_start = int(self.partition.partptr[idx])
      node_end = int(self.partition.partptr[idx + 1])
      node_length = node_end - node_start
  
      indptr = self.partition.indptr[node_start : node_end + 1]
      edge_start = int(indptr[0])
      edge_end = int(indptr[-1])
      edge_length = edge_end - edge_start
      indptr = indptr - edge_start
  
      if self.sparse_format == "csr":
          row = ptr2index(indptr)
          col = self.partition.index[edge_start:edge_end]
          if not self.keep_inter_cluster_edges:
              edge_mask = (col >= node_start) & (col < node_end)
              row = row[edge_mask]
              col = col[edge_mask] - node_start
      else:
          col = ptr2index(indptr)
          row = self.partition.index[edge_start:edge_end]
          if not self.keep_inter_cluster_edges:
              edge_mask = (row >= node_start) & (row < node_end)
              col = col[edge_mask]
              row = row[edge_mask] - node_start
  
      out = copy.copy(self.data)
  
      for key, value in self.data.items():
          if key == "num_nodes":
              out.num_nodes = node_length
          elif self.data.is_node_attr(key):
              cat_dim = self.data.__cat_dim__(key, value)
              out[key] = narrow(value, cat_dim, node_start, node_length)
          elif self.data.is_edge_attr(key):
              cat_dim = self.data.__cat_dim__(key, value)
              out[key] = narrow(value, cat_dim, edge_start, edge_length)
              if not self.keep_inter_cluster_edges:
                  out[key] = out[key][edge_mask]
  
      out.edge_index = torch.stack([row, col], dim=0)
  
      return out
  
imports: import copy
  import os.path
  import sys
  from dataclasses import dataclass
  from typing import List, Literal, Optional
  import torch
  import torch.utils.data
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric.data import Data
  from torch_geometric.typing import pyg_lib
  from torch_geometric.utils import index_sort, narrow, select, sort_edge_index
  from torch_geometric.utils.map import map_index
  from torch_geometric.utils.sparse import index2ptr, ptr2index
label_desc: Use image node_id 6 for calling the ClusterData obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: out