In the context of Social Network Analysis, I want to compute the homogeneity of different networks for specific attributes. For this case the igraph package contains the method assortativity() to compute the assortativity coefficient for similar vertices - http://igraph.org/r/doc/assortativity.html.

assortativity(myGraph, V(myGraph)$class == 0, V(myGraph)$class == 1, directed=T)

Is it legit to compute the assortativity by setting the first attribute value of one class equal zero and the second attribute of the second class equal one? In that case I am not interesting in the similarity of one specific class but rather in the homopholy of different classes. Or is it only possible to compare different vertices (other features) with each other?


1 Answer 1


It looks like what you are asking for is for an assortativity coefficient based on a label for each vertex rather than a numerical value. If that is the case, igraph provides a function for this purpose: assortativity_nominal(). This calculates assortativity using the following formula (taken from the help file): $$r=\frac{\sum_i e_{ii}-\sum_i a_i b_i}{1-\sum_i a_i b_i}$$ where $e(i,j)$ is the fraction of edges connecting vertices of type i and j, $a_i=\sum_j e_{ij}$ and $b_j=\sum_i e_{ij}$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.