Commit 450e8425 authored by Jean-Benoist Leger's avatar Jean-Benoist Leger

equivalent cc

parent 311e4c03
......@@ -349,25 +349,40 @@ int main(int argc, char ** argv)
modified = 0;
iter++;
// first we build a ccid equivalence map
std::unordered_map<ccid_t,ccid_t> equivalence;
for(auto ways_it = ways.begin();
ways_it != ways.end();
ways_it++)
{
ccid_t & ccid = ways_it->second.ccid;
ccid_t new_ccid = ccid;
ccid_t & ccid = equivalence[ways_it->second.ccid];
if(ccid==0) // first we see it
ccid = ways_it->second.ccid;
std::vector<wid_t> & neighbors = way_ways[ways_it->first];
for(unsigned int t=0;t<neighbors.size();t++)
{
ccid_t & neigh_ccid = ways[neighbors[t]].ccid;
if(neigh_ccid < new_ccid)
new_ccid = neigh_ccid;
if(neigh_ccid < ccid)
ccid = neigh_ccid;
}
if(new_ccid < ccid)
}
// no we apply the equivalence map on all ways
for(auto ways_it = ways.begin();
ways_it != ways.end();
ways_it++)
{
ccid_t & ccid = equivalence[ways_it->second.ccid];
if(ccid != ways_it->second.ccid)
{
ccid = new_ccid;
modified++;
ways_it->second.ccid = ccid;
}
}
RV_BLANKLINE;
fprintf(stderr,"\r-> Pass %u done: Modified %u ",iter,modified);
if(modified==0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment