I am working with an undirected igraph object composed of nodes of different types (e.g. males M in yellow and females F in orange):
g <- graph.atlas(711)
V(g)$name <- 1:7
V(g)$gender <- c("M","F","M","M","M","F","F")
V(g)$color <- ifelse(V(g)$gender=="F", "orange","yellow")
g<-delete.edges(g, E(g, P=c(1,2,2,3,2,7,7,6,7,3,3,4,3,5,4,5,5,6,6,1)))
g<-add.edges(g,c(1,4,4,5,5,1,4,7,7,3,3,5,5,7,2,7,7,6,6,2,6,4))
plot(g)
I would like to extract an edge list composed of the edges connecting nodes of different types (males and females):
edgelist <- rbind(c(3,7),
c(4,6),
c(4,7),
c(5,7))
assortativity
uses the fraction of edges connecting vertices of type M and F, but I do not know to extract explicity these edges.
get.edgelist
only returns the whole edge list with no possibility of setting conditions.