In the previous tutorial, we learnt how to find places (defined as patterns of academic curricula) from a two-mode relational dataset linking students’ with the colleges they attended in the United States. In this new instalment, we will use a dual approach to conduct a joint analysis of the network of places linked by universities, and its transposed version - the network of universities linked by places, as shown on fig. 2. Through this joint network analysis, we aim to better understand how academic curricula were connected through universities, and conversely, how the universities were interconnected through students’ trajectories. By jointly analyzing the two networks, we adapt Everett and Borgatti’s dual-projection approach to places 1 in order to take advantage of the duality property of place-based networks emphasized by Pizarro (Pizarro, 2000, 2002). In this tutorial, we rely on igraph to build and visualize the networks, analyze their global structure, and extract some local features (centrality measures) to examine the nodes relative position in the networks. In the last section, we rely on principal component analysis (PCA) and hierarchical clustering (HCPC) to identify positional profiles, based on the nodes’ centrality measures and other qualitative attributes.

Recap

Summary of previous steps

# load packages

library(Places)
library(tidyverse)

# load original data 

aucplaces <- read_delim("Data/aucdata.csv",
delim = ";", escape_double = FALSE, trim_ws = TRUE)
aucplaces <- as.data.frame(aucplaces) 

# retrieve places 

Result1 <- places(aucplaces, "Name_eng", "University")
result1df <- as.data.frame(Result1$PlacesData) 

# load annotated data (places manually labeled wit qualitative attributes)

place_attributes <- read_csv("Data/place_attributes.csv",
col_types = cols(...1 = col_skip())) # manually labeled places

# load university data (region)

univ_region <- read_delim("Data/univ_region.csv",
delim = ";", escape_double = FALSE, trim_ws = TRUE)

Create networks

The results of place detection performed with “Places” include an edge list of places linked by sets (Edgelist). We will use this list to build both the network of places linked by universities (sets), and the transposed network of universities (sets) linked by places.

To build a network of places linked by universities:

# First, we build an adjacency matrix from the edgelist contained in the results of place detection:

bimod<-table(Result1$Edgelist$Places, Result1$Edgelist$Set) 
PlacesMat<-bimod %*% t(bimod)
diag(PlacesMat)<-0 

# Next, we use igraph to create a network from the adjacency matrix:

library(igraph)
Pla1Net<-graph_from_adjacency_matrix(PlacesMat, mode="undirected", weighted = TRUE)


We apply the same method for building the transposed network of universities linked by places:

# create the adjacency matrix
bimod2<-table(Result1$Edgelist$Set, Result1$Edgelist$Places)
PlacesMat2<-bimod2 %*% t(bimod2)
diag(PlacesMat2)<-0

# build network from adjacency matrix with igraph
Pla2Net<-graph_from_adjacency_matrix(PlacesMat2, mode="undirected", weighted = TRUE)


Note: we can further convert the igraph object into an edge list that can be exported and re-used in network analysis software such as Gephi or Cytoscape:

# convert igraph object into edge list 
edgelist1 <- as_edgelist(Pla1Net)
edgelist2 <- as_edgelist(Pla2Net)
# export edge lists and node list as csv files
write.csv(edgelist1, "edgelist1.csv")
write.csv(result1df, "nodelist1.csv")
write.csv(edgelist2, "edgelist2.csv")

Visualize

Plot the network graphs with igraph:

plot(Pla1Net, vertex.size = 5, 
     vertex.color = "orange", 
     vertex.label.color = "black", 
     vertex.label.cex = 0.3, 
     main="Network of places linked by universities")