code: def maybe_num_nodes_dict(
      edge_index_dict: Dict[EdgeType, Tensor],
      num_nodes_dict: Optional[Dict[NodeType, int]] = None,
  ) -> Dict[NodeType, int]:
      num_nodes_dict = (
          {} if num_nodes_dict is None else copy(num_nodes_dict)
      )
  
      found_types = list(num_nodes_dict.keys())
  
      for keys, edge_index in edge_index_dict.items():
          key = keys[0]
          if key not in found_types:
              N = int(edge_index[0].max() + 1)
              num_nodes_dict[key] = max(N, num_nodes_dict.get(key, N))
  
          key = keys[-1]
          if key not in found_types:
              N = int(edge_index[1].max() + 1)
              num_nodes_dict[key] = max(N, num_nodes_dict.get(key, N))
  
      return num_nodes_dict
  
file_path: pytorch_geometric/torch_geometric/utils/num_nodes.py
imports: from copy import copy
  from typing import Dict, Optional, Tuple, Union
  import torch
  from torch import Tensor
  import torch_geometric
  from torch_geometric import EdgeIndex
  from torch_geometric.typing import EdgeType, NodeType, SparseTensor
label_desc: Use image node_id 2 for calling a global function with example usage: maybe_num_nodes_dict(edge_index_dict, num_nodes_dict) and returns: num_nodes_dict