[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Issues trying to get tree using layout.reingold.tilford
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Issues trying to get tree using layout.reingold.tilford |
Date: |
Sat, 15 Dec 2012 23:41:03 +0100 |
> I'm trying to use R igraph to get x,y coordinates to plot vertices in another
> application. The data should show a simple organisation chart, hence the
> desire for a top-down tree.
> [...]
> Looking at l I get something similar to:
>
> [,1] [,2]
> [1,] 0.000000e+00 2.116259e+214
> [2,] 0.000000e+00 2.116259e+214
> [3,] 3.239144e-319 2.116259e+214
> [4,] 0.000000e+00 2.116259e+214
> [5,] 8.156530e-320 2.116259e+214
> [6,] 6.147313e+257 0.000000e+00
>
> (top lines only) which isn't what I'm expecting.
Seems like this is an issue which arises only in the 64-bit version of R -- at
least on my machine. Using the layout algorithm from either the R interface on
a 32-bit R version, or from the Python interface seems to work, although the
layout does not make sense because layout.reingold.tilford assumes that the
tree is oriented _downwards_, i.e. it will follow the outbound edges only. So,
reversing the direction of all of your edges also resolves the issue:
> gdf <- graph(as.vector(t(get.edgelist(gdf, names=F)[,c(2,1)])))
> l <- layout.reingold.tilford(gdf)
> l
[,1] [,2]
[1,] 0.0 3
[2,] -6.7 2
[3,] -3.2 2
[4,] 0.3 2
[5,] 3.3 2
[6,] 6.3 2
[7,] -8.2 1
[8,] -7.2 1
[9,] -6.2 1
[10,] -5.2 1
[11,] -4.2 1
[12,] -3.2 1
[13,] -2.2 1
[14,] -2.7 0
[15,] -1.7 0
[16,] 0.3 1
[17,] -0.7 0
[18,] 0.3 0
[19,] 1.3 0
[20,] 1.3 1
[21,] 2.3 1
[22,] 3.3 1
[23,] 4.3 1
[24,] 5.3 1
[25,] 6.3 1
I will file a bug for this in our issue tracker. Thanks for the bug report!
--
Tamas