class_docstr: Collects rooted :math:`k`-hop EgoNets for each node in the graph, as
  described in the `"From Stars to Subgraphs: Uplifting Any GNN with Local
  Structure Awareness" <https://arxiv.org/abs/2110.03753>`_ paper.
  
  Args:
      num_hops (int): the number of hops :math:`k`.
class_docstr_tok: ["Collects","rooted",":","math",":","`","k","`","-hop","EgoNets","for","each","node","in","the","graph",",","as","described","in","the","`","``","From","Stars","to","Subgraphs",":","Uplifting","Any","GNN","with","Local","Structure","Awareness","''","<","https",":","\/\/arxiv.org\/abs\/2110.03753",">","`","_","paper",".","Args",":","num_hops","(","int",")",":","the","number","of","hops",":","math",":","`","k","`","."]
code: def extract(
      self,
      data: Data,
  ) -> Tuple[Tensor, Tensor, Tensor, Tensor, Tensor]:
      assert data.edge_index is not None
      num_nodes = data.num_nodes
      assert num_nodes is not None
  
      adj_t = to_torch_csc_tensor(data.edge_index, size=data.size()).t()
      n_mask = torch.eye(num_nodes, device=data.edge_index.device)
      for _ in range(self.num_hops):
          n_mask += adj_t @ n_mask
  
      return self.map(data, n_mask > 0)
  
imports: import copy
  from abc import ABC, abstractmethod
  from typing import Any, Tuple
  import torch
  from torch import Tensor
  from torch_geometric.data import Data
  from torch_geometric.transforms import BaseTransform
  from torch_geometric.utils import to_torch_csc_tensor
label_desc: Use image node_id 2 for calling the RootedEgoNets obj's underlying member method code with example usage: obj.extract(data) and returns: self