if (FALSE) {
nnodes <- 200
nnedges <- 400
nodes <- data.frame(id = 1:nnodes)
edges <- data.frame(from = sample(1:nnodes, nnedges, replace = T),
to = sample(1:nnodes, nnedges, replace = T))
# with default layout
visNetwork(nodes, edges) %>%
visIgraphLayout()
# use full space
visNetwork(nodes, edges) %>%
visIgraphLayout(type = "full")
# in circle ?
visNetwork(nodes, edges) %>%
visIgraphLayout(layout = "layout_in_circle") %>%
visOptions(highlightNearest = list(enabled = T, hover = T),
nodesIdSelection = T)
# keep physics with smooth curves ?
visNetwork(nodes, edges) %>%
visIgraphLayout(physics = TRUE, smooth = TRUE)
# fix randomSeed to keep position
visNetwork(nodes, edges) %>%
visIgraphLayout(randomSeed = 123)
visNetwork(nodes, edges) %>%
visIgraphLayout(randomSeed = 123)
# layout_with_sugiyama
nodes <- data.frame(id = 1:5)
edges <- data.frame(from = c(1, 2, 2, 4), to = c(2, 3, 4, 5))
visNetwork(nodes, edges) %>%
visIgraphLayout(layout = "layout_with_sugiyama", layers = c(1, 2, 3, 3, 4))
visNetwork(nodes, edges) %>%
visIgraphLayout(layout = "layout_with_sugiyama")
}
Run the code above in your browser using DataLab