My code is below, I have used all graphing visualisation libraries and noticed for observations eg: 100000 + they do not load a graph at all
A 30000 observation took more than 20 minutes to load, how can I expedite the process, my server has 32gb ram and 16 cpus so I don't think that's an issue although I am not sure if my code is parallelised?
to <- df %>%
distinct(to) %>%
rename(label = to)
from <- df %>%
distinct(from) %>%
rename(label = from)
nodes <- full_join(to, from, by = "label")
nodes <- nodes %>% rowid_to_column("id")
per_route <- df %>%
group_by(from, to) %>%
summarise(weight = n()) %>%
ungroup()
edges <- per_route %>%
left_join(nodes, by = c("to" = "label")) %>%
rename(to = id)
edges <- edges %>%
left_join(nodes, by = c("from" = "label")) %>%
rename(from = id)
edges <- select(edges, from, to, weight)
visNetwork(nodes, edges) %>%
visPhysics(stabilization = FALSE) %>%
visIgraphLayout() %>%
visEdges(arrows = "from")`
with graph
routes_tidy <- tbl_graph(nodes = nodes, edges = edges, directed = TRUE)
routes_igraph_tidy <- as_tbl_graph(routes_igraph)
routes_tidy %>%
activate(edges) %>%
arrange(desc(weight))
ggraph(routes_tidy) + geom_edge_link() + geom_node_point() + theme_graph()
ggraph(routes_tidy, layout = "graphopt") +
geom_node_point() +
geom_edge_link(aes(width = weight), alpha = 0.8) +
scale_edge_width(range = c(0.2, 2)) +
geom_node_text(aes(label = label), repel = TRUE) +
labs(edge_width = "Letters") +
theme_graph()