# Load and build network
data(student_interactions)
head(student_interactions)
# Remove self-loops and build igraph
el <- student_interactions[student_interactions$from != student_interactions$to, ]
if (requireNamespace("igraph", quietly = TRUE)) {
g <- igraph::graph_from_data_frame(el, directed = FALSE)
cat("Students:", igraph::vcount(g), "\n")
cat("Interactions:", igraph::ecount(g), "\n")
}
Run the code above in your browser using DataLab