code: def getAffinityGraphMat(
      affinity_mat_raw: torch.Tensor, p_value: int
  ) -> torch.Tensor:
      """
      Calculate a binarized graph matrix and
      symmetrize the binarized graph matrix.
      """
      X = (
          affinity_mat_raw
          if p_value <= 0
          else getKneighborsConnections(affinity_mat_raw, p_value)
      )
      symm_affinity_mat = 0.5 * (X + X.T)
      return symm_affinity_mat
  
imports: from typing import Dict, List, Tuple
  import torch
  from torch.linalg import eigh, eigvalsh
label_desc: Use image node_id 9 for calling a global function with example usage: getAffinityGraphMat(affinity_mat_raw, p_value) and returns: symm_affinity_mat