Commit 13d1258a authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

blockmodel: Remove unused block edges

parent 9ad7b3bb
...@@ -203,7 +203,7 @@ public: ...@@ -203,7 +203,7 @@ public:
if (get<0>(delta) == 0) // can happen with zero-weight if (get<0>(delta) == 0) // can happen with zero-weight
return; // edges return; // edges
if (Add && me == this->_emat.get_null_edge()) if (Add && me == _emat.get_null_edge())
{ {
me = add_edge(r, s, this->_bg).first; me = add_edge(r, s, this->_bg).first;
_emat.put_me(r, s, me); _emat.put_me(r, s, me);
...@@ -230,6 +230,11 @@ public: ...@@ -230,6 +230,11 @@ public:
case weight_type::DELTA_T: case weight_type::DELTA_T:
this->_brec[me] += get<1>(delta); this->_brec[me] += get<1>(delta);
} }
if (!Add && this->_mrs[me] == 0)
{
_emat.remove_me(me, this->_bg);
}
}); });
if (_rec_type == weight_type::DELTA_T) // waiting times if (_rec_type == weight_type::DELTA_T) // waiting times
...@@ -358,6 +363,9 @@ public: ...@@ -358,6 +363,9 @@ public:
case weight_type::DISCRETE_POISSON: case weight_type::DISCRETE_POISSON:
_brec[me] -= _rec[e]; _brec[me] -= _rec[e];
} }
if (_mrs[me] == 0)
_emat.remove_me(me, _bg);
} }
} }
......
...@@ -529,6 +529,7 @@ class NestedBlockState(object): ...@@ -529,6 +529,7 @@ class NestedBlockState(object):
if l > 0: if l > 0:
self.levels[l]._state.sync_emat() self.levels[l]._state.sync_emat()
self.levels[l]._state.clear_egroups()
self.levels[l]._state.rebuild_neighbour_sampler() self.levels[l]._state.rebuild_neighbour_sampler()
if l < len(self.levels) - 1: if l < len(self.levels) - 1:
self.levels[l + 1]._state.sync_emat() self.levels[l + 1]._state.sync_emat()
......
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