code: def edit_distance_matrix(train_x, train_y=None):
      """Calculate the edit distance.
      Args:
          train_x: A list of neural architectures.
          train_y: A list of neural architectures.
      Returns:
          An edit-distance matrix.
      """
      if train_y is None:
          ret = np.zeros((train_x.shape[0], train_x.shape[0]))
          for x_index, x in enumerate(train_x):
              for y_index, y in enumerate(train_x):
                  if x_index == y_index:
                      ret[x_index][y_index] = 0
                  elif x_index < y_index:
                      ret[x_index][y_index] = edit_distance(x, y)
                  else:
                      ret[x_index][y_index] = ret[y_index][x_index]
          return ret
      ret = np.zeros((train_x.shape[0], train_y.shape[0]))
      for x_index, x in enumerate(train_x):
          for y_index, y in enumerate(train_y):
              ret[x_index][y_index] = edit_distance(x, y)
      return ret
  
imports: import math
  import random
  from copy import deepcopy
  from functools import total_ordering
  from queue import PriorityQueue
  import numpy
  from scipy.linalg import LinAlgError, cho_solve, cholesky, solve_triangular
  from scipy.optimize import linear_sum_assignment
  from sklearn.metrics.pairwise import rbf_kernel
  from nni.utils import OptimizeMode
  from .graph_transformer import transform
  from .utils import Constant
  from .layers import is_layer
label_desc: Use image node_id 7 for calling a global function with example usage: edit_distance_matrix(train_x, train_y) and returns: ret, ret