# Get the depth of each node in a tree
create_tree(10, 2) %>%
activate(nodes) %>%
mutate(depth = bfs_dist(root = 1))
# Reorder nodes based on a depth first search from node 3
create_notable('franklin') %>%
activate(nodes) %>%
mutate(order = dfs_rank(root = 3)) %>%
arrange(order)
Run the code above in your browser using DataLab