code: def subset_cost_matrix(
      cost_matrix, row_ids, col_ids, num_rows, num_cols
  ):
      # Extract thr subset of cost matrix corresponding to rows/cols in arrays row_ids/col_ids
      # Note that the shape of cost_matrix is (num_rows+num_cols) * (num_rows+num_cols)
      extended_row_ids = np.concatenate(
          (row_ids, np.array([k + num_rows for k in col_ids]))
      )
      extended_col_ids = np.concatenate(
          (col_ids, np.array([k + num_cols for k in row_ids]))
      )
      return cost_matrix[extended_row_ids, :][:, extended_col_ids]
  
file_path: dgl/examples/pytorch/graph_matching/ged.py
imports: from copy import deepcopy
  from heapq import heapify, heappop, heappush, nsmallest
  import dgl
  import numpy
  from lapjv import lapjv
label_desc: Use image node_id 4 for calling a global function with example usage: subset_cost_matrix(cost_matrix, row_ids, col_ids, num_rows, num_cols) and returns: cost_matrix