Returns a reduced graph constructed using the generalized block modeling technique.
The blockmodel technique collapses nodes into blocks based on a given partitioning of the node set. Each partition of nodes (block) is represented as a single node in the reduced graph.
Edges between nodes in the block graph are added according to the edges in the original graph. If the parameter multigraph is False (the default) a single edge is added with a weight equal to the sum of the edge weights between nodes in the original graph The default is a weight of 1 if weights are not specified. If the parameter multigraph is True then multiple edges are added each with the edge data from the original graph.
Parameters : | G : graph
partitions : list of lists, or list of sets
multigraph : bool, optional
|
---|---|
Returns : | blockmodel : a Networkx graph object |
References
[R51] | Patrick Doreian, Vladimir Batagelj, and Anuska Ferligoj “Generalized Blockmodeling”,Cambridge University Press, 2004. |
Examples
>>> G=nx.path_graph(6)
>>> partition=[[0,1],[2,3],[4,5]]
>>> M=nx.blockmodel(G,partition)