LayeredBlockState with edge weights and/or different set of nodes across layers

Dear Community,

I've been working on community detection for some time already (Louvain/Leiden algorithms), but I got started with graph-tool only recently. After spending some time scrolling the HOWTO, I still haven't found answers to my two concerns that are related to the applicability of SBM to my data.

I'm analysing political coalitions by combining data from a survey, newspapers, and Twitter. To study coalitions across the three weighted networks (or more if I include temporal slices), I am using LayeredBlockState through NestedBlockState.

Question 1:
I haven't found an answer to whether it is possible to run SBM for layered networks with edge weights? I can get around this problem by extracting the noise-corrected 'backbone' of each network, which yields simple graphs, but ideally I wouldn't have to do too much violence to the data but be able to use the raw weighted networks as inputs. Is it possible to run LayeredBlockState with edge weights?

Question 2:
Even if the LayeredBlockState would not (yet) support weighted networks, I also have another, more fundamental question. As my three layers come from different data generation processes, they do not share the exactly same set of nodes. For example, one organisation responded the survey but doesn't necessarily appear in the newspaper data. Is possible to determine constraints for certain nodes in certain layers that would tell the LayeredBlockState to not consider layer-specific isolates?

This is how my current code looks like, but I am not sure if I can count on the results due to the issue outlined in Q2.

g = binary multigraph with three layers stored in ep.layer
state = gt.inference.nested_blockmodel.NestedBlockState(g, base_type=LayeredBlockState, state_args=dict(ec=g.ep.layer, layers=True))

After running this, I sample from the posterior distribution.

Any help is much appreciated.

Dear Community,

I've been working on community detection for some time already (Louvain/Leiden algorithms), but I got started with graph-tool only recently. After spending some time scrolling the HOWTO, I still haven't found answers to my two concerns that are related to the applicability of SBM to my data.

I'm analysing political coalitions by combining data from a survey, newspapers, and Twitter. To study coalitions across the three weighted networks (or more if I include temporal slices), I am using LayeredBlockState through NestedBlockState.

Question 1:
I haven't found an answer to whether it is possible to run SBM for layered networks with edge weights? I can get around this problem by extracting the noise-corrected 'backbone' of each network, which yields simple graphs, but ideally I wouldn't have to do too much violence to the data but be able to use the raw weighted networks as inputs. Is it possible to run LayeredBlockState with edge weights?

Yes, it's perfectly possible. Just pass the edge covariate parameters
(recs, rec_types, rec_params) to LayeredBlockState as you would
otherwise to BlockState.

Question 2:
Even if the LayeredBlockState would not (yet) support weighted networks, I also have another, more fundamental question. As my three layers come from different data generation processes, they do not share the exactly same set of nodes. For example, one organisation responded the survey but doesn't necessarily appear in the newspaper data. Is possible to determine constraints for certain nodes in certain layers that would tell the LayeredBlockState to not consider layer-specific isolates?

If you used the "layers=True" version of the model, then the nodes of
degree zero in a given layer are considered not to be long to that
layer, i.e. they have a probability of zero of receiving edges of that type.

Best,
Tiago