Skip to Content.
Sympa Menu

cgal-discuss - Union find usage

Subject: CGAL users discussion list

List archive

Union find usage


Chronological Thread 
  • From: Benjamin SCHWARZ <>
  • To: CGAL <>
  • Subject: Union find usage
  • Date: Tue, 10 Apr 2007 12:11:25 +0200

Hello,

I am currently reading an old code and find some dubious lines. Can
you please tell me if my Union Find utilisation is correct ?

------------------------
typedef CGAL::Union_find< Cell_handle > UnionFindForCellHandle;
UnionFindForCellHandle uf;

// Bootstrap : every pocket cell is a singletton
for (j = cells.begin(); j!=cells.end();j++) {
if ((*j)->info().getPocketNumber() != -1) {
uf.make_set(*j);
};
};

// doube rambling and merge touching cells
UnionFindForCellHandle::iterator u,v;
int idx;
for (u = uf.begin(); u != uf.end(); u++) {
for (v = uf.begin(); v != u; v++) {
------------------------

In the last line of this code sample :
"for (v = uf.begin(); v != u;"
I postulated that iterators u and v will trasverse the union find
structure in the same sequence, so that I can stop v on the "diagonal"
and avoid symetrical stuff. And the thing seems to run OK... Is this a
trustable feature of union find iterators or is this a side efect of the
actual implementation ?

--Ben



  • Union find usage, Benjamin SCHWARZ, 04/10/2007

Archive powered by MHonArc 2.6.16.

Top of Page