{\r
for (int e_it = g.start[v]; e_it != -1; e_it = g.edges[e_it].next)\r
{\r
- int comp1 = comps.find(v);\r
- int comp2 = comps.find(g.edges[e_it].to);\r
- if (comp1 != comp2 && g.edges[e_it].val.dr < hr \r
- && g.edges[e_it].val.dsp < hsp)\r
- comps.merge(comp1, comp2);\r
+ int c1 = comps.find(v);\r
+ int c2 = comps.find(g.edges[e_it].to);\r
+ if (c1 != c2 && g.edges[e_it].val.dr < hr && g.edges[e_it].val.dsp < hsp)\r
+ comps.merge(c1, c2);\r
}\r
}\r
\r
LOG2("initedges:", clock() - start);\r
DBG(start = clock());\r
\r
+ // Prepare edges connecting differnet components\r
for (int v = 0; v < g.numv; ++v)\r
{\r
- int comp1 = comps.find(v);\r
+ int c1 = comps.find(v);\r
for (int e_it = g.start[v]; e_it != -1; e_it = g.edges[e_it].next)\r
{\r
- int comp2 = comps.find(g.edges[e_it].to);\r
- if (comp1 != comp2)\r
- edges.push_back(SegmLink(comp1, comp2, g.edges[e_it].val));\r
+ int c2 = comps.find(g.edges[e_it].to);\r
+ if (c1 != c2)\r
+ edges.push_back(SegmLink(c1, c2, g.edges[e_it].val));\r
}\r
}\r
\r
DBG(start = clock());\r
\r
// Exclude small components (starting from the nearest couple)\r
- vector<SegmLink>::iterator e_it = edges.begin();\r
- for (; e_it != edges.end(); ++e_it)\r
+ for (size_t i = 0; i < edges.size(); ++i)\r
{\r
- int comp1 = comps.find(e_it->from);\r
- int comp2 = comps.find(e_it->to);\r
- if (comp1 != comp2 && (comps.size[comp1] < minsize || comps.size[comp2] < minsize))\r
- comps.merge(comp1, comp2);\r
+ int c1 = comps.find(edges[i].from);\r
+ int c2 = comps.find(edges[i].to);\r
+ if (c1 != c2 && (comps.size[c1] < minsize || comps.size[c2] < minsize))\r
+ comps.merge(c1, c2);\r
}\r
\r
LOG2("excludesmall:", clock() - start);\r