I take the 4 syllables " "ha", "mu", "ra", "bi"
Using the following code, I can find out all combinations that can be made with these 4 syllables:
library(dplyr)
objects <- c("ha", "mu", "ra", "bi")
combinations <- expand.grid(objects, objects, objects, objects)
combinations$name <- apply(combinations, 1, function(x) {
paste(x, collapse = "-")
})
combinations$id = 1:nrow(combinations)
combinations <- select(combinations, id, everything())
Now, using the igraph package, I am trying to make a network/graph that visualizes all possible combinations of these syllables. This would look something like this:
Can someone please show me how I can restructure my data to then create this visualization?
Here is an example with 3
layers
objects <- c("ha", "mu", "ra", "bi")
n <- 3 # height of tree
N <- sum(length(objects)^(0:n)) # total number of vertices, including a virtual root
make_tree(N, length(objects)) %>%
delete.vertices(1) %>%
set_vertex_attr("name", value = rep(objects, length.out = vcount(.))) %>%
plot(layout = layout_as_tree)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With