3

I use igraph in R for drawing a network graph in R,but I cant get a graph based on the edges length (eg (A,B) 5cm , (B,C) 2cm).please help me to sole the problem. How can I assign the particular distance in this program.

abhinand
  • 31
  • 1
  • 2

1 Answers1

0

You can use the layout to plot the vertex at certain position. You can define the layout in a manner that respect a certain distance between vertex. A layout is defined in a matrix with 2 columns and a row for each node. The first column indicates its x position and the second its y position.

Here an example:

library(igraph)
gg <- graph.ring(4)
ll =matrix(c(0,0,0,1,0,3,0,5),ncol=2,byrow=TRUE)
plot(gg,layout=ll)

enter image description here

agstudy
  • 119,832
  • 17
  • 199
  • 261