code: def filter_adj(
      edge_index: Tensor,
      edge_attr: Optional[Tensor],
      node_index: Tensor,
      cluster_index: Optional[Tensor] = None,
      num_nodes: Optional[int] = None,
  ) -> Tuple[Tensor, Optional[Tensor]]:
      num_nodes = maybe_num_nodes(edge_index, num_nodes)
  
      if cluster_index is None:
          cluster_index = torch.arange(
              node_index.size(0), device=node_index.device
          )
  
      mask = node_index.new_full((num_nodes,), -1)
      mask[node_index] = cluster_index
  
      row, col = edge_index[0], edge_index[1]
      row, col = mask[row], mask[col]
      mask = (row >= 0) & (col >= 0)
      row, col = row[mask], col[mask]
  
      if edge_attr is not None:
          edge_attr = edge_attr[mask]
  
      return torch.stack([row, col], dim=0), edge_attr
  
file_path: pytorch_geometric/torch_geometric/nn/pool/connect/filter_edges.py
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from torch_geometric.nn.pool.connect import Connect, ConnectOutput
  from torch_geometric.nn.pool.select import SelectOutput
  from torch_geometric.utils.num_nodes import maybe_num_nodes
label_desc: Use image node_id 1 for calling a global function with example usage: filter_adj(edge_index, edge_attr, node_index, cluster_index, num_nodes) and returns: torch,  edge_attr