nodes <- data.frame(id = 1:10)
edges <- data.frame(from = round(runif(8)*10), to = round(runif(8)*10))
visNetwork(nodes, edges) %>%
visLayout(randomSeed = 123)
visNetwork(nodes, edges) %>%
visLayout(hierarchical = TRUE)
visNetwork(nodes, edges) %>%
visHierarchicalLayout(direction = "LR")
Run the code above in your browser using DataLab