Create Weighted Graph from Group Membership Data
问题 Suppose I have a dataset in R indicating the individuals within groups. Here is an example: grp <- c(1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5) ind <- c("A", "C", "D", "B", "C", "D", "E", "A", "D", "E", "B", "F", "E", "A", "F") data.frame(grp, ind) So, the data look like this: grp ind 1 1 A 2 1 C 3 1 D 4 2 B 5 2 C 6 2 D 7 2 E 8 3 A 9 3 D 10 3 E 11 4 B 12 4 F 13 4 E 14 5 A 15 5 F So, group 1 is composed of individuals (A, C, D), group 2 is composed of individuals (B, C, D, E), and so on. I