Hi Tiago,

Still working on this same issue here... A quick question - is there any 
principled way to reconcile between the overlapping partitions (i.e., return 
majority blocks) stored in the new vertex property map "bm"?

1. I thought about passing bm to BlockState(b = bm) using a layer-specific 
GraphView and get_majority_blocks(), but the constructor doesn't accept 
overlapping partitions as b.
2. I also noticed that I can use state.layer_states[0].get_majority_blocks(), 
but for some reason the number of vertices in each of the 10 overlapping states 
differs from the ones they should have, thus not sure about how to interpret 
them.

gt.seed_rng(42); np.random.seed(42)
state = gt.minimize_blockmodel_dl(g, state = gt.LayeredBlockState, state_args = 
dict(deg_corr = True, overlap = True, layers = True, ec = g.ep.layer, recs = 
[g.ep.weight], rec_types = ["real-exponential"]))

print(state)
...
<LayeredBlockState object with 9012 overlapping blocks, 10 layers, 
degree-corrected, with 2 edge covariates, for graph <Graph object, undirected, 
with 113 vertices and 4506 edges, 1 internal vertex property, 2 internal edge 
properties, at 0x2abef36cf6d0>, at 0x2abef48360a0>
...

be = state.get_edge_blocks()
bm = g.new_vertex_property("vector<int>", val = [0] * state.get_B())

for e in g.edges():
    if g.ep.layer[e] != 0: #the layer I want the memberships for
        continue
    u, v = e
    u, v = sorted((u, v))
    r, s = be[e]
    bm[u][r] += 1
    bm[v][s] += 1

for v in g.vertices():
    bm[v] = [i for i in bm[v] if i != 0]

for v in g.vertices()
    print(bm[v])
...
array([9], dtype=int32)
array([5], dtype=int32)
array([22,  1], dtype=int32)
array([15], dtype=int32)
array([ 3, 12], dtype=int32)
...

All help is much appreciated.

Best,
Arttu
_______________________________________________
graph-tool mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to