
Calculating the mixing matrix and assortativity coefficient with igraph in R
The mixing matrix of a graph gives the density of edges between vertices with different characteristics. The mixing matrix for a given igraph object can be calculated using the following function: # calculate the mixing matrix of in igraph graph object ‘mygraph’, by some vertex attribute ‘attrib’ # can change the default use.density=FALSE to…