Commit 127dc08e authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

graph_generation.hh: Fix segfault

parent 7561129f
...@@ -538,9 +538,8 @@ struct gen_graph ...@@ -538,9 +538,8 @@ struct gen_graph
while (s_deg.second > 0) while (s_deg.second > 0)
{ {
//assert(!targets.empty()); // assert(!targets.empty());
//assert(t_iter != targets.end()); // assert(t_iter != targets.end());
while (v_iter == vset.end() || v_iter->second.empty()) while (v_iter == vset.end() || v_iter->second.empty())
{ {
++t_iter; ++t_iter;
...@@ -559,8 +558,8 @@ struct gen_graph ...@@ -559,8 +558,8 @@ struct gen_graph
swap(v_list.back(), v_list.front()); swap(v_list.back(), v_list.front());
v_list.pop_back(); v_list.pop_back();
update_deg(t_i, nt_deg, vset, targets, sources, g); update_deg(t_i, nt_deg, vset, targets, sources, g);
//t_iter = targets.begin(); t_iter = targets.begin();
//v_iter = vset.find(*t_iter); v_iter = vset.find(*t_iter);
continue; continue;
} }
...@@ -591,6 +590,8 @@ struct gen_graph ...@@ -591,6 +590,8 @@ struct gen_graph
update_deg(skip[i], update_deg(skip[i],
get_deg(vertices[skip[i]], g), vset, get_deg(vertices[skip[i]], g), vset,
targets, sources, g); targets, sources, g);
t_iter = targets.begin();
v_iter = vset.find(*t_iter);
} }
skip.clear(); skip.clear();
if (no_self_loops) if (no_self_loops)
...@@ -611,7 +612,7 @@ struct gen_graph ...@@ -611,7 +612,7 @@ struct gen_graph
update_deg(skip[i], update_deg(skip[i],
get_deg(vertices[skip[i]], g), get_deg(vertices[skip[i]], g),
vset, targets, sources, g); vset, targets, sources, g);
} }
if (verbose) if (verbose)
cout << endl; cout << endl;
......
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