let union point1 point2 =
  let point1 = repr point1
  and point2 = repr point2 in
  assert (point1 != point2);
  match point1.link, point2.link with
  | Info info1, Info info2 ->
      let weight1 = info1.weight
      and weight2 = info2.weight in
      if weight1 >= weight2 then begin
        point2.link <- Link point1;
        info1.weight <- weight1 + weight2;
        info1.descriptor <- info2.descriptor
      end
      else begin
        point1.link <- Link point2;
        info2.weight <- weight1 + weight2
      end
  | _, _ ->
      assert false