Sorry for the vague question, I'm having difficulties in specifying exactly what I need. I hope the example will make it clearer.
I have a network with various node attributes (like country affiliation, etc.). I am interested in how many of the nodes from a country are connected to the same or a different country.
So, in the example network:
require(igraph)
zach <- graph("Zachary") # the Zachary carate club
V(zach)$new_var <- sample(c('tomato', 'gold', 'steelblue'), gorder(zach), replace = TRUE)
plot(zach, vertex.size=10, vertex.label=NA, vertex.color = V(zach)$new_var)
I am interested here in, for example, how many blue nodes are connected to blue, to red, etc.