Commit 41d98f5c authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

blockmodel: Fix minor issue with zero-weight edges

parent 65ea9489
......@@ -209,6 +209,9 @@ public:
entries_op(_m_entries, _emat,
[&](auto r, auto s, auto& me, auto& delta)
{
if (get<0>(delta) == 0) // can happen with zero-weight
return; // edges
beop(false, me);
if (Add && me == this->_emat.get_null_edge())
......
......@@ -1408,7 +1408,8 @@ public:
void insert_edge(const Edge& e, DynamicSampler<Edge>& elist,
size_t weight, size_t& pos)
{
if (pos < elist.size() && elist.is_valid(pos) && elist[pos] == e)
if ((pos < elist.size() && elist.is_valid(pos) && elist[pos] == e) ||
weight == 0)
return;
assert(pos >= elist.size() || !elist.is_valid(pos) || elist[pos] != e);
pos = elist.insert(e, weight);
......
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