top of page
Search

Data Visualization - d3Network

Updated: Dec 16, 2022

Interactive link - Nodes.html



Raw data: American College football: Network of American football games between Division IA colleges during regular season Fall 2000. Please cite M. Girvan and M. E. J. Newman, Proc. Natl. Acad. Sci. USA 99, 7821-7826 (2002)


R Script

setwd("C:/Users/benzi/OneDrive/Desktop/Data Mining/Football")

library(networkD3)

football_v1 <- read.graph("football.gml", format="gml")

conferences <- c("Atlantic Coast", "Big East", "Big Ten", "Big Twelve", 
               "Conference USA", "Independents", "Mid-American", "Mountain 
               West", "Pacific Ten", "Southeastern", "Sun Belt", "Western 
               Athletic")
               
V(football_v1)$conference <- conferences[V(football_v1)$value + 1]

write.graph(football_v1, "football_edit.gml", format="gml")

football.nodes <- get.data.frame(football_v1, what = "vertices")
football.edges <- get.data.frame(football_v1, what = "edges")

str(football.nodes)
str(football.edges)

football.edges$from <- football.edges$from - 1
football.edges$to <- football.edges$to - 1

forceNetwork(Links = football.edges, Nodes = football.nodes,
             Source = "from", Target = "to",
             NodeID = "label",
             legend = TRUE,
             linkDistance = 100,
             Group = "conference", opacity = 1.0, zoom = TRUE)                           
                                      
        

10 views0 comments

Recent Posts

See All

Comments


bottom of page