code: def GetRecvWeights(
      topo: nx.DiGraph, rank: int
  ) -> Tuple[float, Dict[int, float]]:
      """Return a Tuple of self_weight and neighbor_weights for receiving dictionary."""
      weight_matrix = nx.to_numpy_array(topo)
      self_weight = 0.0
      neighbor_weights = {}
      for src_rank in topo.predecessors(rank):
          if src_rank == rank:
              self_weight = weight_matrix[src_rank, rank]
          else:
              neighbor_weights[src_rank] = weight_matrix[src_rank, rank]
      return self_weight, neighbor_weights
  
imports: from typing import List, Tuple, Dict, Iterator, Optional
  import math
  import numpy
  import networkx
label_desc: Use image node_id 2 for calling a global function with example usage: GetRecvWeights(topo, rank) and returns: self_weight,  neighbor_weights