10.2 Tripartite network analysis?
How to add the respective department of each class to the story?
<- data.frame(class = c("Biostatistics","Islamic Civ", "Calc 1", "Linear Algebra", "Chemistry", "The Modern World-System", "Calc 2", "Social Networks", "Exile and Diaspora"), department = c("Math", "History", "Math", "Math", "Chemistry", "Sociology", "Math", "Sociology", "History"), stringsAsFactors = F)
classes_to_departments <- table(classes_to_departments)
classes_to_departments_matrix class(classes_to_departments_matrix) <- "matrix"
Now following the paper on tripartite structural analysis, we can multiply the transpose of this matrix by the transpose of classesMatrix to trace links between people and departments!
<- t(classes_to_departments_matrix) %*% t(classesMatrix) people_to_departments
We can graph this matrix and analyze it like a bipartite graph.
%>%
people_to_departments graph.incidence() %>%
as_tbl_graph() %>%
ggraph( layout = 'kk') +
geom_edge_link() +
geom_node_label(aes(label = name, fill = type))
10.2.1 Lab
data(paper_authors)
data(authors)
data(papers)
<- papers %>%
papers filter(year >= 2016)
<- paper_authors %>%
paper_authors filter(paper %in% papers$paper)
<- paper_authors %>%
paper_authors mutate(author = authors$user_nber[match(paper_authors$author , authors$author)])
%>%
paper_authors ::flat_table() %>%
sjmiscgraph.incidence() %>%
as_tbl_graph() %>%
ggraph( layout = 'kk') +
geom_edge_link() +
geom_node_poin()