docs: def kruskal_mst(graph):
      """Implements Kruskal's Algorithm for finding minimum spanning trees.
      Assumes a non-empty, connected graph.
      """
      edges_accepted = 0
      ds = DisjointSet()
      pq = PriorityQueue()
      accepted_edges = []
      label_lookup = {}
  
      nodes = graph.get_all_node_ids()
      num_vertices = len(nodes)
      for n in nodes:
          label = ds.add_set()
          label_lookup[n] = label
  
      edges = graph.get_all_edge_objects()
      for e in edges:
          pq.put(e['id'], e['cost'])
  
      while edges_accepted < (num_vertices - 1):
          edge_id = pq.get()
  
          edge = graph.get_edge(edge_id)
          node_a, node_b = edge['vertices']
          label_a = label_lookup[node_a]
          label_b = label_lookup[node_b]
  
          a_set = ds.find(label_a)
          b_set = ds.find(label_b)
  
          if a_set != b_set:
              edges_accepted += 1
              accepted_edges.append(edge_id)
              ds.union(a_set, b_set)
  
      return accepted_edges