igraph in R: converting a bipartite graph into a one-mode affiliation network

雨燕双飞 提交于 2021-02-07 19:18:36

问题


The following is a toy dataset I created using igraph in Rstudio for a bipartite network of terrorist perpetrators and their targets. The following specification is for a directed bipartite relationship between both types of vertices:

set.seed(1234)

 df <- data.frame(
     perpetrator <- c(
         'Armed Islamic Group (GIA)',
         'Armed Islamic Group (GIA)',
         'Algerian Islamic Extremists',
         'Islamic Salvation Front (FIS)',
         'Unindentified Activists',
         'Armed Islamic Group (GIA)',
         'Armata di Liberazione Naziunale (ALN)',
         'Armed Islamic Group (GIA)',
         'Islamist Extremists',
         'Muslim Fundamentalists'),
      target <- c(
         'Unnamed Civilians',
         'Unnamed Civilians',
         'Unnamed Civilians',
         'Government Buildings',
         'Police Station',
         'Soldiers',
         'Terrorist Group',
         'Unnamed Civilians',
         'Police Patrol',
         'Police Patrol'),
      stringsAsFactors = TRUE)

net <- graph.edgelist(as.matrix(df))

V(net)$type <- bipartite.mapping(net)$type

proj_net <- bipartite.projection(net)

plot(net, 
 main = "Bipartite Projection of Algerian Terror Network",
 layout=-layout.bipartite(net)[,2:1])

My question: How would I convert this into a one-mode (unipartite) affiliation network where the vertices are terrorist perpetrators and the edges are common targets between perpetrators? My hunch tells me I have to matrix multiply and plot the adjacency matrix, but I've been unsuccessful following some of the example scripts in this forum. I realize that in this toy example I will have some isolates and a handful of dyads, but would like to extend this conversion process to a larger dataset once I get a handle on the mechanics

Second, for the one-mode specification are descriptive measures such as centrality, density, and transitivity the same as in other unpartite graphs, or does descriptive interference in bipartite networks require different measures of network structure?


回答1:


Don't you already have it?

df  <- data.frame(perpetrator=c("A","A","B","C","D","A","E","A","F","G"),
                  target     =c("a","a","a","b","c","d","e","a","f","f"))
net <- graph.edgelist(as.matrix(df))
V(net)$type <- bipartite.mapping(net)$type
par(mfrow=c(1,2),mar=c(0,1,1,1))
plot(net, main="Full Network",edge.arrow.size=0.5)
plot(bipartite.projection(net)$proj1,main="Affilitaton Network")

bipartite.projection(...) returns a list of two graphs, named $proj1 and $proj2, which have the affiliation networks. So in this case, A and B are connected via a, and F and G are connected via f.




回答2:


To address your second question:

Second, for the one-mode specification are descriptive measures such as centrality, density, and transitivity the same as in other unpartite graphs, or does descriptive interference in bipartite networks require different measures of network structure?

This is not a programming, but rather a statistical question. Part of the answer lies in your research question. For instance, see Bonacich et al 1998 for a discussion of group size correlation with centrality measures. I would refer you to the following papers for a start:

Latapy, Matthieu, Clémence Magnien, and Nathalie Del Vecchio. "Basic notions for the analysis of large two-mode networks." Social Networks 30.1 (2008): 31-48.

Faust, Katherine. "Centrality in affiliation networks." Social networks 19.2 (1997): 157-191.

Bonacich, Phillip, Amalya Oliver, and Tom AB Snijders. "Controlling for size in centrality scores." Social networks 20.2 (1998): 135-141.



来源:https://stackoverflow.com/questions/27221478/igraph-in-r-converting-a-bipartite-graph-into-a-one-mode-affiliation-network

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!