Commit c1a1967c authored by Romina Parada's avatar Romina Parada
Browse files

is collapsable fix

parent e1a2b340
......@@ -176,6 +176,17 @@ struct collapsedGraph : genericGraph<graph> {
[this](int deg, pos n) { return deg + is_elem(full_graph, n); });
}
pos_set full_neighbors(pos p){
pos_set adj_p = all_adj(p);
pos_set neighbors;
for(auto it = adj_p; it != adj_p.end(); it++){
pos n = *it;
if(is_elem(full_graph, n)){
neighbor.insert(n);
}
}
return neighbors;
}
// vertex is uncollapsed
bool is_uncollapsed(pos p) { return is_elem(this->positions, p); }
......@@ -189,15 +200,11 @@ struct collapsedGraph : genericGraph<graph> {
return false;
}
AdjacencyIterator it, it_end;
boost::tie(it, it_end) = super::neighbors(p);
pos n1 = this->g[*it].p;
pos dir1 = n1 - p;
it++;
pos n2 = this->g[*it].p;
pos dir2 = n2 - p;
auto it_n = full_neighbors(p).begin();
pos dir1 = (*it_n) - p;
it_n++;
pos dir2 = (*it_n) - p;
return same_direction(dir1,dir2);
}
......@@ -332,14 +339,11 @@ struct collapsedGraph : genericGraph<graph> {
cout<<"PASO 2 CON P: "<<p<<endl;
super::add_v(p);
pos_set adj = all_adj(p);
pos_set adj = full_neighbors(p);
for (auto it = adj.begin(); it != adj.end(); it++) {
pos n = *it;
if(is_elem(full_graph, n)){
super::add_e(p, n);
super::add_e(n, p);
}
super::add_e(p, n);
super::add_e(n, p);
}
// 3. collapse p if possible
......
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