Multiplex

CS Aarhus

> L <- read.table("./multiplex/Aarhus/Dataset/CS-Aarhus_layers.txt",header=TRUE)
> L
  layerID layerLabel
1       1      lunch
2       2   facebook
3       3   coauthor
4       4    leisure
5       5       work
> E <- read.table("./multiplex/Aarhus/Dataset/CS-Aarhus_multiplex.edges",header=FALSE)
> head(E)
  V1 V2 V3 V4
1  1  1  2  1
2  1  1  3  1
3  1 10 11  1
4  1 10 14  1
5  1 10 15  1
6  1 10 16  1
> N <- read.table("./multiplex/Aarhus/Dataset/CS-Aarhus_nodes.txt",header=TRUE)
> head(N)
  nodeID nodeLabel
1      1      U102
2      2      U139
3      3       U33
4      4      U106
5      5      U107
6      6      U118
> info <- list(network="CS Aarhus",
+   title="Relationships between the employees of Computer Science department at Aarhus",
+   by="Matteo Magnani, Barbora Micenkova, Luca Rossi",
+   ref="M Magnani, B Micenkova, L Rossi - Combinatorial Analysis of Multiple Networks. arXiv:1303.4986 (2013)",
+   href="https://manliodedomenico.com/data.php",
+   creator="V. Batagelj",
+   date=date() )
> ways=list(P1="first person",P2="second person",R="relation")
> nodes=list(P1=data.frame(ID=N$nodeLabel),P2=data.frame(ID=N$nodeLabel),
+   R=data.frame(ID=L$layerLabel))
> links=data.frame(P1=E$V2,P2=E$V3,R=E$V1,w=1)
> MA <- list(format="MWnets",info=info,ways=ways,nodes=nodes,links=links,data=list())
> write(toJSON(MA),"./multiplex/Aarhus/CSaarhus.json")
> str(MA)
List of 6
 $ format: chr "MWnets"
 $ info  :List of 7
  ..$ network: chr "CS Aarhus"
  ..$ title  : chr "Relationships between the employees of Computer Science department at Aarhus"
  ..$ by     : chr "Matteo Magnani, Barbora Micenkova, Luca Rossi"
  ..$ ref    : chr "M Magnani, B Micenkova, L Rossi - Combinatorial Analysis of Multiple Networks. arXiv:1303.4986 (2013)"
  ..$ href   : chr "https://manliodedomenico.com/data.php"
  ..$ creator: chr "V. Batagelj"
  ..$ date   : chr "Fri Dec  2 18:42:02 2022"
 $ ways  :List of 3
  ..$ P1: chr "first person"
  ..$ P2: chr "second person"
  ..$ R : chr "relation"
 $ nodes :List of 3
  ..$ P1:'data.frame':  61 obs. of  1 variable:
  .. ..$ ID: chr [1:61] "U102" "U139" "U33" "U106" ...
  ..$ P2:'data.frame':  61 obs. of  1 variable:
  .. ..$ ID: chr [1:61] "U102" "U139" "U33" "U106" ...
  ..$ R :'data.frame':  5 obs. of  1 variable:
  .. ..$ ID: chr [1:5] "lunch" "facebook" "coauthor" "leisure" ...
 $ links :'data.frame': 620 obs. of  4 variables:
  ..$ P1: int [1:620] 1 1 10 10 10 10 11 11 11 12 ...
  ..$ P2: int [1:620] 2 3 11 14 15 16 14 15 16 13 ...
  ..$ R : int [1:620] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ w : num [1:620] 1 1 1 1 1 1 1 1 1 1 ...
 $ data  : list()

Vickers and Chan 7th graders

> L <- read.table("./multiplex/Vickers/Dataset/Vickers-Chan-7thGraders_layers.txt",header=TRUE)
> E <- read.table("./multiplex/Vickers/Dataset/Vickers-Chan-7thGraders_multiplex.edges",header=FALSE)
> head(L)
  layerID   layerLabel
1       1  get_on_with
2       2 best_friends
3       3    work_with
> head(E)
  V1 V2 V3 V4
1  1  1  6  1
2  1  1  8  1
...
> N <- paste("s",1:29,sep="")
> S <- c(rep("boy",12),rep("girl",17))
> info <- list(network="Vickers",
+   title="Vickers Chan 7th graders",
+   by="M Vickers, S Chan",
+   ref="M Vickers, S Chan - Representing Classroom Social Structure. Melbourne: Victoria Institute of Secondary Education. (1981)",
+   href="https://manliodedomenico.com/data.php",
+   creator="V. Batagelj",
+   date=date() )
> ways=list(S1="first student",S2="second student",R="relation")
> nodes=list(S1=data.frame(ID=N,sex=S),S2=data.frame(ID=N),
+   R=data.frame(ID=L$layerLabel))
> links=data.frame(S1=E$V2,S2=E$V3,R=E$V1,w=1)
> MV <- list(format="MWnets",info=info,ways=ways,nodes=nodes,links=links,data=list())
> write(toJSON(MV),"./multiplex/Vickers/Vickers.json")
> str(MV)
List of 6
 $ format: chr "MWnets"
 $ info  :List of 7
  ..$ network: chr "Vickers"
  ..$ title  : chr "Vickers Chan 7th graders"
  ..$ by     : chr "M Vickers, S Chan"
  ..$ ref    : chr "M Vickers, S Chan - Representing Classroom Social Structure. Melbourne: Victoria Institute of Secondary Education. (1981)"
  ..$ href   : chr "https://manliodedomenico.com/data.php"
  ..$ creator: chr "V. Batagelj"
  ..$ date   : chr "Sat Dec 03 02:05:21 2022"
 $ ways  :List of 3
  ..$ S1: chr "first student"
  ..$ S2: chr "second student"
  ..$ R : chr "relation"
 $ nodes :List of 3
  ..$ S1:'data.frame':  29 obs. of  2 variables:
  .. ..$ ID : chr [1:29] "s1" "s2" "s3" "s4" ...
  .. ..$ sex: chr [1:29] "boy" "boy" "boy" "boy" ...
  ..$ S2:'data.frame':  29 obs. of  1 variable:
  .. ..$ ID: chr [1:29] "s1" "s2" "s3" "s4" ...
  ..$ R :'data.frame':  3 obs. of  1 variable:
  .. ..$ ID: chr [1:3] "get_on_with" "best_friends" "work_with"
 $ links :'data.frame': 740 obs. of  4 variables:
  ..$ S1: int [1:740] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ S2: int [1:740] 6 8 11 12 14 16 17 19 21 22 ...
  ..$ R : int [1:740] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ w : num [1:740] 1 1 1 1 1 1 1 1 1 1 ...
 $ data  : list()

Sex partition (in Pajek net file the nodes are reordered)

> stu <- MV$nodes$S1$ID
> p <- factor(stu)
> q <- 1:29; q[p] <- 1:29
> sex <- MV$nodes$S1$sex[q]
> cat(as.integer(sex=="boy")+1,sep="\n")
2
2
...

Students' Cooperation Social Network

Students' Cooperation Social Network was constructed from the data collected during a “Computer and Network Security” course.

Fire, M., Katz, G., Elovici, Y., Shapira, B., & Rokach, L. (2012). Predicting student exam's scores by analyzing social network data. In Active Media Technology (pp. 584-595). Springer Berlin Heidelberg.

http://proj.ise.bgu.ac.il/sns

> setwd("C:/Users/vlado/DL/data/multi/discogs/students")
> source("https://raw.githubusercontent.com/bavla/Rnet/master/R/Pajek.R")
> library(jsonlite)
> ST <- read.csv("multigraph_hashAnonymized.csv")
> dim(ST)
[1] 360   3
> N <- paste("s",1:n,sep="")
> U <- ST$Id1; V <- ST$Id2
> levels(U) <- N; levels(V) <- N
> R <- factor(ST$type)
> uvFac2net(U,V,r=R,Net="students.net")

> info <- list(network="Students",
+   title="Students' Cooperation Social Network",
+   by="Fire, M., Katz, G., Elovici, Y., Shapira, B., & Rokach, L.",
+   ref="Predicting student exam's scores by analyzing social network data. 
  In Active Media Technology (pp. 584-595). Springer Berlin Heidelberg",
+   href="http://proj.ise.bgu.ac.il/sns",
+   creator="V. Batagelj",
+   date=date() )
> ways=list(S1="first student",S2="second student",R="relation")
> nodes=list(S1=data.frame(ID=N),S2=data.frame(ID=N),
+   R=data.frame(ID=levels(R)))
> links=data.frame(S1=U,S2=V,R=as.integer(R),w=1)
> MS <- list(format="MWnets",info=info,ways=ways,nodes=nodes,links=links,data=list())
> str(MS)
List of 6
 $ format: chr "MWnets"
 $ info  :List of 7
  ..$ network: chr "Students"
  ..$ title  : chr "Students' Cooperation Social Network"
  ..$ by     : chr "Fire, M., Katz, G., Elovici, Y., Shapira, B., & Rokach, L."
  ..$ ref    : chr "Predicting student exam's scores by analyzi"| __truncated__
  ..$ href   : chr "http://proj.ise.bgu.ac.il/sns"
  ..$ creator: chr "V. Batagelj"
  ..$ date   : chr "Fri Feb  3 19:48:32 2023"
 $ ways  :List of 3
  ..$ S1: chr "first student"
  ..$ S2: chr "second student"
  ..$ R : chr "relation"
 $ nodes :List of 3
  ..$ S1:'data.frame':  185 obs. of  1 variable:
  .. ..$ ID: chr [1:185] "s1" "s2" "s3" "s4" ...
  ..$ S2:'data.frame':  185 obs. of  1 variable:
  .. ..$ ID: chr [1:185] "s1" "s2" "s3" "s4" ...
  ..$ R :'data.frame':  3 obs. of  1 variable:
  .. ..$ ID: chr [1:3] "Computer" "Partners" "Time"
 $ links :'data.frame': 360 obs. of  4 variables:
  ..$ S1: int [1:360] 1 1 2 2 2 2 3 3 3 4 ...
  .. ..- attr(*, "levels")= chr [1:185] "s1" "s2" "s3" "s4" ...
  ..$ S2: int [1:360] 81 81 27 136 129 45 182 171 122 179 ...
  .. ..- attr(*, "levels")= chr [1:185] "s1" "s2" "s3" "s4" ...
  ..$ R : int [1:360] 2 3 3 3 2 2 2 2 2 2 ...
  ..$ w : num [1:360] 1 1 1 1 1 1 1 1 1 1 ...
 $ data  : list()
> write(toJSON(MS),"Students.json")


vlado/work/2m/mwn/mpx.txt · Last modified: 2023/02/03 19:53 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki