I have the nodes
and edges
dataframes below and I create a circle graph out of them. What I would like to achieve is to use x
and y
coordinates in a way that always the a
node will be on top of the graph regardless of the number of total nodes like the Roger Rabit
node below. The x
and y
positions I gave is randon right now but ideally I would like to create the ring graph with only the coordinates of a
set.
library('igraph')
nodes <- c('a','b','c','d')
x <- c(0,1,2,3)
y <- c(0,1,2,3)
from <- c('a','b','c','d')
to <- c('b','c','d','a')
NodeList <- data.frame(nodes, x ,y)
EdgeList <- data.frame(from, to)
a<- graph_from_data_frame(vertices = NodeList, d= EdgeList, directed = TRUE)
plot(a)