We have created a single Python object,
- Store graphs on ModularityBP Object
- Run modularity belief propagation
- Access discovered partitions and marginals
- Compile results across many different runs
Storing Graphs on ModularityBP Object¶
A representation of a network must be supplied at the instantiation of the
modbp.ModularityBP object. Each instance can only be associated with one network. A network can be supplied in several different formats:
igraph.Graphobject is supplied. In this case network will be treated as single layer. This is pass in through the mlgraph parameter:
Finally, one can pass in an array for intralayer_edges, interlayer_edges, and layer_vec, from which
modbp.ModularityBPwill internally construct a
intra_edges=np.array([[0,1],[0,2],[3,4]]) inter_edges=np.array([[2,3]]) layer_vec=[0,0,0,1,1] modbp_obj=modbp.ModularityBP(intra_edges=intra_edges, inter_edges=inter_edges, layer_vec=layer_vec)
The graph is stored internally each
modbp.ModularityBP as a
modbp.MultilayerGraph and is accessible through
Running Multilayer Modularity Belief Propagation¶
run_modbp(beta, q, niter=100, resgamma=1.0, omega=1.0, reset=False)¶
- beta – The inverse tempature parameter at which to run the modularity belief propagation algorithm. Must be specified each time BP is run.
- q – The number of mariginals used for the run of modbp. Note that if self.use_effective is true, The final number of reported communities could be lower.
- niter – Maximum number of iterations allowed. If self._align_communities_across_layers is true, the actual number of runs could be higher than this upper bound though at most 2*niter
- resgamma – The resolution parameter at which to run modbp. Default is resgamma=1.0
- omega – The coupling strength used in running multimodbp. This represent how strongly the algorithm tries to assign nodes connected by an interlayer connection to the same community.
- reset – If true, the marginals will be rerandomized when this method is called. Otherwise the state will be maintained from previous runs if existing (assuming q hasn’t changed).