Created
April 17, 2012 02:26
-
-
Save gweissman/2403004 to your computer and use it in GitHub Desktop.
sample calculating mixing matrix and assortativity coefficient with igraph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sample calculating mixing matrix and assortativity coefficient with igraph | |
require(igraph) | |
set.seed(12) | |
# create a random graph | |
g <- random.graph.game(1000,0.15) | |
# assign some characteristics | |
V(g)$color <- c('red','white','blue','orange','green') | |
# calculate the mixing matrix | |
m <- mixmat(g,'color') | |
# now calculate the assortativity coefficient | |
assortcoeff(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment