Example #1
0
void unsigned_union_find::isolate(size_type a)
{
  check_index(a);

  // is a itself a root?
  if(is_root(a))
  {
    size_type c=nodes[a].count;

    // already isolated?
    if(c==1)
      return;

    assert(c>=2);

    // find a new root
    size_type new_root=get_other(a);
    assert(new_root!=a);

    re_root(a, new_root);
  }

  // now it's not a root
  // get its root
  size_type r=find(a);

  // assert(r!=a);

  nodes[r].count--;
  nodes[a].parent=a;
  nodes[a].count=1;
}
Example #2
0
MutableHash get_mutable_hash(pointer p) {
  return get_other(p)->mut_hash;
}