networkqit.algorithms.community.comm_mat

comm_mat(adj, memb)[source]

Returns multiple community related quantities.

adj : array: a possibly weighted n x n adjacency matrix in the form of a N x N numpy array memb: array, list: the nodal membership vector, a numpy array or list of integers.

B: :class`~np.array`: the CxC block matrix containing in its (r,s) element the number of links from community r to community s. Bnorm: :class`~np.array`: the CxC block matrix containing in its (r,s) element the density of links. It is the same as B but divided by the actual number of possible node pairs nr x ns for off-diagonal terms, (nr x (nr-1))/2 for diagonal elements.

holland-stochastic-1983

Paul W. Holland, Kathryn Blackmond Laskey, Samuel Leinhardt, “Stochastic blockmodels: First steps”, Carnegie-Mellon University, Pittsburgh, PA 15213, U.S.A., :doi:`10.1016/0378-8733(83)90021-7`.