code: def remove_duplicate_edges_undirected(udg):
      
      # With undirected edges, we need to hash both combinations of the to-from node ids, since a-b and b-a are equivalent
      # --For aesthetic, we sort the edge ids so that lower edges ids are kept
      lookup = {}
      edges = sorted(udg.get_all_edge_ids())
      for edge_id in edges:
          e = udg.get_edge(edge_id)
          tpl_a = e['vertices']
          tpl_b = (tpl_a[1], tpl_a[0])
          if tpl_a in lookup or tpl_b in lookup:
              udg.delete_edge_by_id(edge_id)
          else:
              lookup[tpl_a] = edge_id
              lookup[tpl_b] = edge_id
docs: Removes duplicate edges from an undirected graph.