Commit 1d2b1fab authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

blockmodel: fix bug with vertex movements

parent c9a7fd1d
Pipeline #211 failed with stage
in 5405 minutes and 43 seconds
......@@ -181,7 +181,7 @@ public:
{
get_move_entries(v, r, nr, m_entries,
[](auto) { return false; },
[&](auto u) -> auto& { return this->_b[u]; });
[&](auto u) -> size_t { return this->_b[u]; });
}
......@@ -234,7 +234,7 @@ public:
if (Add)
{
auto& b_v = get_b(v);
auto&& b_v = get_b(v);
b_v = r;
add_partition_node(v, r);
}
......@@ -286,7 +286,7 @@ public:
}
template <class EFilt, class GetB>
void remove_vertex(size_t v, size_t r, EFilt && efilt, GetB && get_b)
void remove_vertex(size_t v, size_t r, EFilt&& efilt, GetB&& get_b)
{
modify_vertex<false>(v, r, efilt, get_b);
}
......@@ -372,6 +372,7 @@ public:
void add_vertex(size_t v, size_t r, Efilt&& efilt, GetB&& get_b)
{
modify_vertex<true>(v, r, efilt, get_b);
assert(size_t(get_b(v)) == r);
}
template <class Efilt>
......@@ -494,9 +495,11 @@ public:
{
_coupled_state->set_vertex_weight(nr, 1);
_coupled_state->add_partition_node(nr, _bclabel[r]);
_coupled_state->_b[nr] = _bclabel[r];
_bclabel[nr] = _bclabel[r];
}
}
assert(size_t(get_b(v)) == nr);
}
void move_vertex(size_t v, size_t nr)
......@@ -1084,7 +1087,7 @@ public:
MEntries& m_entries)
{
return virtual_move(v, r, nr, ea, m_entries,
[&](auto u) -> auto& { return this->_b[u]; });
[&](auto u) -> size_t { return this->_b[u]; });
}
double virtual_move(size_t v, size_t r, size_t nr, entropy_args_t ea)
......
......@@ -1479,10 +1479,10 @@ void build_neighbour_sampler(Vertex v, SMap& sampler, Eprop& eweight, Graph& g,
u = source(e, g);
if (!self_loops && u == v)
continue;
neighbours.push_back(u);
auto w = eweight[e];
if (w == 0)
continue;
neighbours.push_back(u);
probs.push_back(w); // Self-loops will be added twice, and hence will
// be sampled with probability 2 * eweight[e]
}
......
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