Commit 44a65959 authored by Tiago Peixoto's avatar Tiago Peixoto

Add support for "target_blocks" in mcmc_sweep()

parent 3a1dec89
......@@ -196,16 +196,16 @@ struct move_sweep_dispatch
{
move_sweep_dispatch(Eprop eweight, Vprop vweight, boost::any egroups,
VEprop esrcpos, VEprop etgtpos, Vprop label,
vector<int>& vlist, bool deg_corr, bool dense,
bool multigraph, double beta, bool sequential,
bool parallel, bool random_move, double c, bool verbose,
size_t max_edge_index, size_t nmerges, size_t niter,
Vprop merge_map, partition_stats_t& partition_stats,
rng_t& rng, double& S, size_t& nmoves,
GraphInterface& bgi)
vector<int64_t>& vlist, vector<int64_t>& target_list,
bool deg_corr, bool dense, bool multigraph, double beta,
bool sequential, bool parallel, bool random_move,
double c, bool verbose, size_t max_edge_index,
size_t nmerges, size_t niter, Vprop merge_map,
partition_stats_t& partition_stats, rng_t& rng,
double& S, size_t& nmoves, GraphInterface& bgi)
: eweight(eweight), vweight(vweight), oegroups(egroups), esrcpos(esrcpos),
etgtpos(etgtpos), label(label), vlist(vlist),
etgtpos(etgtpos), label(label), vlist(vlist), target_list(target_list),
deg_corr(deg_corr), dense(dense), multigraph(multigraph), beta(beta),
sequential(sequential), parallel(parallel), random_move(random_move),
c(c), verbose(verbose), max_edge_index(max_edge_index),
......@@ -221,7 +221,8 @@ struct move_sweep_dispatch
VEprop etgtpos;
Vprop label;
size_t n;
vector<int>& vlist;
vector<int64_t>& vlist;
vector<int64_t>& target_list;
bool deg_corr;
bool dense;
bool multigraph;
......@@ -358,19 +359,36 @@ struct move_sweep_dispatch
vector<decltype(state)> states = {state};
vector<EntrySet<Graph>> m_entries = {EntrySet<Graph>(num_vertices(bg))};
move_sweep(states, m_entries,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)),
cv, vmap,
label.get_unchecked(num_vertices(bg)), vlist, deg_corr,
dense, multigraph, beta,
eweight.get_unchecked(max_edge_index),
vweight.get_unchecked(num_vertices(g)),
g, sequential, parallel, random_move, c,
nmerges,
merge_map.get_unchecked(num_vertices(g)),
niter, num_vertices(bg),
verbose, rng, S, nmoves);
if (target_list.empty())
{
move_sweep(states, m_entries,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)),
cv, vmap,
label.get_unchecked(num_vertices(bg)), vlist, deg_corr,
dense, multigraph, beta,
eweight.get_unchecked(max_edge_index),
vweight.get_unchecked(num_vertices(g)),
g, sequential, parallel, random_move, c,
nmerges,
merge_map.get_unchecked(num_vertices(g)),
niter, num_vertices(bg),
verbose, rng, S, nmoves);
}
else
{
auto ub = b.get_unchecked(num_vertices(g));
for (size_t i = 0; i < vlist.size(); ++i)
{
size_t v = vlist[i];
size_t s = target_list[i];
S += virtual_move(v, s, ub, cv, vmap, states, m_entries,
dense, deg_corr, multigraph);
move_vertex(v, s, ub, cv, vmap, deg_corr, states,
not random_move);
nmoves++;
}
}
}
};
......@@ -380,7 +398,8 @@ boost::python::object do_move_sweep(GraphInterface& gi, GraphInterface& bgi,
boost::any cavity_sampler, boost::any omrs,
boost::any omrp, boost::any omrm,
boost::any owr, boost::any ob,
boost::any olabel, vector<int>& vlist,
boost::any olabel, vector<int64_t>& vlist,
vector<int64_t>& target_list,
bool deg_corr, bool dense, bool multigraph,
boost::any oeweight, boost::any ovweight,
boost::any oegroups, boost::any oesrcpos,
......@@ -421,8 +440,8 @@ boost::python::object do_move_sweep(GraphInterface& gi, GraphInterface& bgi,
run_action<graph_tool::detail::all_graph_views, boost::mpl::true_>()
(gi, std::bind(move_sweep_dispatch<emap_t, vmap_t, vemap_t>
(eweight, vweight, oegroups, esrcpos, etgtpos,
label, vlist, deg_corr, dense, multigraph, beta,
sequential, parallel, random_move, c, verbose,
label, vlist, target_list, deg_corr, dense, multigraph,
beta, sequential, parallel, random_move, c, verbose,
gi.GetMaxEdgeIndex(), nmerges, niter, merge_map,
partition_stats, rng, S, nmoves, bgi),
mrs, mrp, mrm, wr, b, placeholders::_1,
......@@ -645,9 +664,9 @@ double do_get_deg_entropy_term(GraphInterface& gi, boost::any ob,
}
vector<int32_t> get_vector(size_t n)
vector<int64_t> get_vector(size_t n)
{
return vector<int32_t>(n);
return vector<int64_t>(n);
}
template <class Value>
......
......@@ -2451,7 +2451,7 @@ template <class Graph, class Vprop, class VVprop, class VLprop,
class Eprop, class RNG, class BlockState, class MEntries>
void move_sweep(vector<BlockState>& states, vector<MEntries>& m_entries_r,
Vprop wr, Vprop b, VLprop cv, VVprop vmap, Vprop clabel,
vector<int>& vlist, bool deg_corr, bool dense, bool multigraph,
vector<int64_t>& vlist, bool deg_corr, bool dense, bool multigraph,
double beta, Eprop eweight, Vprop vweight, Graph& g,
bool sequential, bool parallel, bool random_move, double c,
size_t nmerges, Vprop merge_map, size_t niter, size_t B,
......
......@@ -55,7 +55,8 @@ struct cov_move_sweep_dispatch
vector<std::reference_wrapper<boost::any>>& egroups,
vector<std::reference_wrapper<VEprop>>& esrcpos,
vector<std::reference_wrapper<VEprop>>& etgtpos,
Vprop& label, vector<int>& vlist, bool deg_corr,
Vprop& label, vector<int64_t>& vlist,
vector<int64_t>& target_blocks, bool deg_corr,
bool dense, bool multigraph, double beta,
bool sequential, bool parallel, bool random_move,
bool node_coherent, bool confine_layers, double c,
......@@ -74,7 +75,8 @@ struct cov_move_sweep_dispatch
size_t B)
: ce(ce), cv(cv), vmap(vmap), eweight(eweight), vweight(vweight),
oegroups(egroups), esrcpos(esrcpos), etgtpos(etgtpos), label(label), vlist(vlist),
oegroups(egroups), esrcpos(esrcpos), etgtpos(etgtpos), label(label),
vlist(vlist), target_blocks(target_blocks),
deg_corr(deg_corr), dense(dense), multigraph(multigraph), beta(beta),
sequential(sequential), parallel(parallel), random_move(random_move),
node_coherent(node_coherent), confine_layers(confine_layers),
......@@ -99,7 +101,8 @@ struct cov_move_sweep_dispatch
vector<std::reference_wrapper<VEprop>>& etgtpos;
Vprop& label;
size_t n;
vector<int>& vlist;
vector<int64_t>& vlist;
vector<int64_t>& target_blocks;
bool deg_corr;
bool dense;
bool multigraph;
......@@ -321,21 +324,38 @@ struct cov_move_sweep_dispatch
m_entries.emplace_back(num_vertices(bgs[i].get()));
}
move_sweep(states, m_entries,
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)),
cv.get_unchecked(num_vertices(g)),
vmap.get_unchecked(num_vertices(g)),
label.get_unchecked(B),
vlist, deg_corr,
dense, multigraph, beta,
eweight[0].get().get_unchecked(max_edge_index[0]),
vweight[0].get().get_unchecked(num_vertices(g)),
g, sequential, parallel, random_move, c,
nmerges,
merge_map.get_unchecked(num_vertices(g)),
niter, B,
verbose, rng, S, nmoves);
if (target_blocks.empty())
{
move_sweep(states, m_entries,
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)),
cv.get_unchecked(num_vertices(g)),
vmap.get_unchecked(num_vertices(g)),
label.get_unchecked(B),
vlist, deg_corr,
dense, multigraph, beta,
eweight[0].get().get_unchecked(max_edge_index[0]),
vweight[0].get().get_unchecked(num_vertices(g)),
g, sequential, parallel, random_move, c,
nmerges,
merge_map.get_unchecked(num_vertices(g)),
niter, B,
verbose, rng, S, nmoves);
}
else
{
auto ub = b.get_unchecked(num_vertices(g));
for (size_t i = 0; i < vlist.size(); ++i)
{
size_t v = vlist[i];
size_t s = target_blocks[i];
S += virtual_move(v, s, ub, cv, vmap, states, m_entries,
dense, deg_corr, multigraph);
move_vertex(v, s, ub, cv, vmap, deg_corr, states,
not random_move);
nmoves++;
}
}
}
else
{
......@@ -380,44 +400,62 @@ struct cov_move_sweep_dispatch
}
vector<SingleEntrySet<Graph>> m_entries(states.size());
if (nmerges == 0)
if (target_blocks.empty())
{
if (!node_coherent)
if (nmerges == 0)
{
move_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(B),
vlist, deg_corr, dense, multigraph, beta,
vweight[0].get().get_unchecked(num_vertices(g)), g,
sequential, parallel, random_move, c, niter,
B, verbose, rng, S, nmoves);
if (!node_coherent)
{
move_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(B),
vlist, deg_corr, dense, multigraph, beta,
vweight[0].get().get_unchecked(num_vertices(g)), g,
sequential, parallel, random_move, c, niter,
B, verbose, rng, S, nmoves);
}
else
{
vector<EntrySet<Graph>> m_entries;
for (auto& state : states)
m_entries.emplace_back(num_vertices(state.bg));
coherent_move_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(B),
vlist, deg_corr, dense, multigraph, beta,
vweight[0].get().get_unchecked(num_vertices(g)), g,
sequential, random_move, c,
confine_layers, niter,
B, rng, S, nmoves);
}
}
else
{
vector<EntrySet<Graph>> m_entries;
for (auto& state : states)
m_entries.emplace_back(num_vertices(state.bg));
coherent_move_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(B),
vlist, deg_corr, dense, multigraph, beta,
vweight[0].get().get_unchecked(num_vertices(g)), g,
sequential, random_move, c,
confine_layers, niter,
B, rng, S, nmoves);
merge_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), ce, cv,
vmap, label.get_unchecked(B), vlist,
deg_corr, dense, multigraph, g,
random_move, confine_layers, nmerges, niter,
B, rng, S, nmoves);
}
}
else
{
merge_sweep_overlap(states, m_entries, overlap_stats[0].get(),
wr[0].get().get_unchecked(B),
b.get_unchecked(num_vertices(g)), ce, cv,
vmap, label.get_unchecked(B), vlist,
deg_corr, dense, multigraph, g,
random_move, confine_layers, nmerges, niter,
B, rng, S, nmoves);
half_edge_neighbour_policy<Graph> npolicy(g);
auto ub = b.get_unchecked(num_vertices(g));
for (size_t i = 0; i < vlist.size(); ++i)
{
size_t v = vlist[i];
size_t s = target_blocks[i];
S += virtual_move(v, s, ub, cv, vmap, states, m_entries,
dense, deg_corr, multigraph, npolicy);
move_vertex(v, s, ub, cv, vmap, deg_corr, states,
not random_move, npolicy);
nmoves++;
}
}
}
}
......@@ -470,7 +508,8 @@ boost::python::object do_cov_move_sweep(GraphInterface& gi,
boost::python::object& ofree_blocks,
boost::python::object& omaster,
boost::python::object& oslave,
boost::any& olabel, vector<int>& vlist,
boost::any& olabel,
boost::python::object& ovlist,
bool deg_corr, bool dense,
bool multigraph,
boost::python::object& oeweight,
......@@ -545,6 +584,8 @@ boost::python::object do_cov_move_sweep(GraphInterface& gi,
auto master = from_list<bool>(omaster);
auto slave = from_list<bool>(oslave);
vector<int64_t>& vlist = boost::python::extract<vector<int64_t>&>(ovlist[0]);
vector<int64_t>& target_blocks = boost::python::extract<vector<int64_t>&>(ovlist[1]);
bool node_coherent = python::extract<bool>(onode_coherent[0]);
bool confine_layers = python::extract<bool>(onode_coherent[1]);
......@@ -552,7 +593,7 @@ boost::python::object do_cov_move_sweep(GraphInterface& gi,
run_action<graph_tool::detail::all_graph_views, boost::mpl::true_>()
(gi, std::bind(cov_move_sweep_dispatch<emap_t, vmap_t, vvmap_t, emap_t, bmap_t>
(ce, cv, vmap, eweight, vweight, egroups, esrcpos, etgtpos,
label, vlist, deg_corr, dense, multigraph, beta,
label, vlist, target_blocks, deg_corr, dense, multigraph, beta,
sequential, parallel, random_move, node_coherent,
confine_layers, c, verbose,
gi.GetMaxEdgeIndex(), eidx, nmerges, niter, merge_map,
......
......@@ -50,7 +50,9 @@ struct move_sweep_overlap_dispatch
{
move_sweep_overlap_dispatch(Eprop eweight, Vprop vweight,
boost::any egroups, VEprop esrcpos,
VEprop etgtpos, Vprop label, vector<int>& vlist,
VEprop etgtpos, Vprop label,
vector<int64_t>& vlist,
vector<int64_t>& target_blocks,
bool deg_corr, bool dense, bool multigraph,
bool parallel_edges, double beta,
bool sequential, bool parallel,
......@@ -63,7 +65,7 @@ struct move_sweep_overlap_dispatch
GraphInterface& bgi)
: eweight(eweight), vweight(vweight), oegroups(egroups), esrcpos(esrcpos),
etgtpos(etgtpos), label(label), vlist(vlist),
etgtpos(etgtpos), label(label), vlist(vlist), target_blocks(target_blocks),
deg_corr(deg_corr), dense(dense), multigraph(multigraph),
parallel_edges(parallel_edges), beta(beta), sequential(sequential),
parallel(parallel), random_move(random_move), c(c),
......@@ -80,7 +82,8 @@ struct move_sweep_overlap_dispatch
VEprop etgtpos;
Vprop label;
size_t n;
vector<int>& vlist;
vector<int64_t>& vlist;
vector<int64_t>& target_blocks;
bool deg_corr;
bool dense;
bool multigraph;
......@@ -209,42 +212,60 @@ struct move_sweep_overlap_dispatch
vector<decltype(state)> states = {state};
vector<SingleEntrySet<Graph>> m_entries(1);
if (nmerges == 0)
if (target_blocks.empty())
{
if (!node_coherent)
if (nmerges == 0)
{
move_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(num_vertices(bg)),
vlist, deg_corr, dense, multigraph, beta,
vweight.get_unchecked(num_vertices(g)), g,
sequential, parallel, random_move, c, niter,
num_vertices(bg), verbose, rng, S, nmoves);
if (!node_coherent)
{
move_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(num_vertices(bg)),
vlist, deg_corr, dense, multigraph, beta,
vweight.get_unchecked(num_vertices(g)), g,
sequential, parallel, random_move, c, niter,
num_vertices(bg), verbose, rng, S, nmoves);
}
else
{
vector<EntrySet<Graph>> m_entries(1, EntrySet<Graph>(num_vertices(bg)));
coherent_move_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(num_vertices(bg)),
vlist, deg_corr, dense, multigraph, beta,
vweight.get_unchecked(num_vertices(g)), g,
sequential, random_move, c,
false, niter,
num_vertices(bg), rng, S, nmoves);
}
}
else
{
vector<EntrySet<Graph>> m_entries(1, EntrySet<Graph>(num_vertices(bg)));
coherent_move_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), cv,
vmap, label.get_unchecked(num_vertices(bg)),
vlist, deg_corr, dense, multigraph, beta,
vweight.get_unchecked(num_vertices(g)), g,
sequential, random_move, c,
false, niter,
num_vertices(bg), rng, S, nmoves);
merge_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), ce, cv, vmap,
label.get_unchecked(num_vertices(bg)), vlist,
deg_corr, dense, multigraph, g, random_move,
false, nmerges, niter,
num_vertices(bg), rng, S, nmoves);
}
}
else
{
merge_sweep_overlap(states, m_entries, overlap_stats,
wr.get_unchecked(num_vertices(bg)),
b.get_unchecked(num_vertices(g)), ce, cv, vmap,
label.get_unchecked(num_vertices(bg)), vlist,
deg_corr, dense, multigraph, g, random_move,
false, nmerges, niter,
num_vertices(bg), rng, S, nmoves);
half_edge_neighbour_policy<Graph> npolicy(g);
auto ub = b.get_unchecked(num_vertices(g));
for (size_t i = 0; i < vlist.size(); ++i)
{
size_t v = vlist[i];
size_t s = target_blocks[i];
S += virtual_move(v, s, ub, cv, vmap, states, m_entries,
dense, deg_corr, multigraph, npolicy);
move_vertex(v, s, ub, cv, vmap, deg_corr, states,
not random_move, npolicy);
nmoves++;
}
}
}
};
......@@ -255,7 +276,8 @@ do_move_sweep_overlap(GraphInterface& gi, GraphInterface& bgi, boost::any& emat,
boost::any sampler, boost::any cavity_sampler,
boost::any omrs, boost::any omrp, boost::any omrm,
boost::any owr, boost::any ob, boost::any olabel,
vector<int>& vlist, bool deg_corr, bool dense,
vector<int64_t>& vlist, vector<int64_t>& target_blocks,
bool deg_corr, bool dense,
bool multigraph, bool parallel_edges, boost::any oeweight,
boost::any ovweight, boost::any oegroups,
boost::any oesrcpos, boost::any oetgtpos, double beta,
......@@ -295,9 +317,9 @@ do_move_sweep_overlap(GraphInterface& gi, GraphInterface& bgi, boost::any& emat,
run_action<graph_tool::detail::all_graph_views, boost::mpl::true_>()
(gi, std::bind(move_sweep_overlap_dispatch<emap_t, vmap_t, vemap_t>
(eweight, vweight, oegroups, esrcpos, etgtpos,
label, vlist, deg_corr, dense, multigraph, parallel_edges,
beta, sequential, parallel, random_move, c, node_coherent,
verbose, gi.GetMaxEdgeIndex(), nmerges,
label, vlist, target_blocks, deg_corr, dense, multigraph,
parallel_edges, beta, sequential, parallel, random_move,
c, node_coherent, verbose, gi.GetMaxEdgeIndex(), nmerges,
niter, merge_map, overlap_stats, partition_stats, rng, S,
nmoves, bgi),
mrs, mrp, mrm, wr, b, placeholders::_1,
......
......@@ -1370,7 +1370,7 @@ void move_sweep_overlap(vector<BlockState>& states,
vector<MEntries>& m_entries_r,
overlap_stats_t& overlap_stats, Vprop wr, Vprop b,
VLprop cv, VVprop vmap, Vprop clabel,
vector<int>& vlist, bool deg_corr, bool dense,
vector<int64_t>& vlist, bool deg_corr, bool dense,
bool multigraph, double beta, Vprop vweight, Graph& g,
bool sequential, bool parallel, bool random_move,
double c, size_t niter, size_t B, bool verbose,
......@@ -1618,7 +1618,7 @@ void coherent_move_sweep_overlap(vector<BlockState>& states,
vector<MEntries>& m_entries,
overlap_stats_t& overlap_stats, Vprop wr,
Vprop b, VLprop cv, VVprop vmap, Vprop clabel,
vector<int>& vlist, bool deg_corr, bool dense,
vector<int64_t>& vlist, bool deg_corr, bool dense,
bool multigraph, double beta, Vprop vweight,
Graph& g, bool sequential, bool random_move,
double c, bool confine_layers, size_t niter,
......@@ -1820,7 +1820,7 @@ void merge_sweep_overlap(vector<BlockState>& states,
vector<MEntries>& m_entries,
overlap_stats_t& overlap_stats, Vprop wr, Vprop b,
EVprop ce, VLprop cv, VVprop vmap, Vprop clabel,
vector<int>& vlist, bool deg_corr, bool dense,
vector<int64_t>& vlist, bool deg_corr, bool dense,
bool multigraph, Graph& g, bool random_move,
size_t confine_layers, size_t nmerges, size_t ntries,
size_t B, RNG& rng, double& S, size_t& nmoves)
......
......@@ -823,8 +823,8 @@ def get_akc(B, I, N=float("inf"), directed=False):
def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
multigraph=False, node_coherent=False, confine_layers=False,
sequential=True, parallel=False, vertices=None, verbose=False,
**kwargs):
sequential=True, parallel=False, vertices=None,
target_groups=None, verbose=False, **kwargs):
r"""Performs a Markov chain Monte Carlo sweep on the network, to sample the block partition according to a probability :math:`\propto e^{-\beta \mathcal{S}_{t/c}}`, where :math:`\mathcal{S}_{t/c}` is the blockmodel entropy.
Parameters
......@@ -875,6 +875,9 @@ def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
vertices : ``list of ints`` (optional, default: ``None``)
A list of vertices which will be attempted to be moved. If ``None``, all
vertices will be attempted.
target_blocks : ``list of ints`` (optional, default: ``None``)
A list of groups to which the corresponding vertices will to be forcibly
moved. If ``None``, the standard MCMC rules will be applied.
verbose : ``bool`` (optional, default: ``False``)
If ``True``, verbose information is displayed.
......@@ -995,16 +998,26 @@ def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
return 0., 0
if vertices is not None:
vlist = libcommunity.get_vector(len(vertices))
vlist.a = vertices
vertices = vlist
temp = libcommunity.get_vector(len(vertices))
temp.a = vertices
vertices = temp
state.sweep_vertices = vertices
if state.sweep_vertices is None:
elif (state.sweep_vertices is None or
len(state.sweep_vertices.a) < state.g.num_vertices()):
vertices = libcommunity.get_vector(state.g.num_vertices())
vertices.a = state.g.vertex_index.copy("int").fa
state.sweep_vertices = vertices
if target_blocks is not None:
temp = libcommunity.get_vector(len(target_blocks))
temp.a = target_blocks
target_blocks = temp
if len(target_blocks) != len(state.sweep_vertices):
raise ValueError("'target_blocks' must have the same length as 'vertices'")
else:
target_blocks = libcommunity.get_vector(0)
random_move = c == float("inf")
bclabel = state.get_bclabel()
......@@ -1084,6 +1097,7 @@ def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
_prop("v", state.g, state.b),
_prop("v", state.bg, bclabel),
state.sweep_vertices,
target_blocks,
state.deg_corr, dense, multigraph,
_prop("e", state.g, state.eweight),
_prop("v", state.g, state.vweight),
......@@ -1111,6 +1125,7 @@ def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
_prop("v", state.g, state.b),
_prop("v", state.bg, bclabel),
state.sweep_vertices,
target_blocks,
state.deg_corr, dense, multigraph,
multigraph,
_prop("e", state.g, state.eweight),
......@@ -1159,7 +1174,7 @@ def mcmc_sweep(state, beta=1., c=1., niter=1, dl=False, dense=False,
[state.master for state in states],
[state.slave for state in states],
_prop("v", None, bclabel),
main_state.sweep_vertices,
[main_state.sweep_vertices, target_blocks],
main_state.deg_corr, dense, multigraph,
[_prop("e", state.g, state.eweight) for state in states],
[_prop("v", state.g, state.vweight) for state in states],
......
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