I am aware of some Python code (see e.g. here), so I tried to replicate this in R:
nodes <- data.frame(name = c("1", "2", "3"