code: def min_connect_path(points):
      assert isinstance(points, list)
      assert all([isinstance(point, list) for point in points])
      assert all(
          [
              isinstance(coord, int)
              for point in points
              for coord in point
          ]
      )
  
      points_queue = points.copy()
      shortest_path = []
      current_edge = [[], []]
  
      edge_dict0 = {}
      edge_dict1 = {}
      current_edge[0] = points_queue[0]
      current_edge[1] = points_queue[0]
      points_queue.remove(points_queue[0])
      while points_queue:
          for point in points_queue:
              length0 = norm2(point, current_edge[0])
              edge_dict0[length0] = [point, current_edge[0]]
              length1 = norm2(current_edge[1], point)
              edge_dict1[length1] = [current_edge[1], point]
          key0 = min(edge_dict0.keys())
          key1 = min(edge_dict1.keys())
  
          if key0 <= key1:
              start = edge_dict0[key0][0]
              end = edge_dict0[key0][1]
              shortest_path.insert(
                  0, [points.index(start), points.index(end)]
              )
              points_queue.remove(start)
              current_edge[0] = start
          else:
              start = edge_dict1[key1][0]
              end = edge_dict1[key1][1]
              shortest_path.append(
                  [points.index(start), points.index(end)]
              )
              points_queue.remove(end)
              current_edge[1] = end
  
          edge_dict0 = {}
          edge_dict1 = {}
  
      shortest_path = functools.reduce(operator.concat, shortest_path)
      shortest_path = sorted(
          set(shortest_path), key=shortest_path.index
      )
  
      return shortest_path
  
imports: import functools
  import operator
  import numpy
  import paddle
  from numpy.linalg import norm
  import cv2
label_desc: Use image node_id 6 for calling a global function with example usage: min_connect_path(points) and returns: shortest_path