I originally posted this on stackoverflow (http://stackoverflow.com/questions/13867120/getting-x-y-coordinates-for-tree-graph-using-r-igraph) and was referred here.
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. My data set can be found here: https://dl.dropbox.com/u/80762057/RelationshipData.csv I read this csv as a data.frame which I call RelationshipData I then graph this using: > gdf<-graph.data.frame(RelationshipData) Which gives the warning message: In graph.data.frame(RelationshipData) : In `d' `NA' elements were replaced with string "NA" As my first ID hasn't got a manager ID (because he's the boss) and therefore no edge relationship I remove this line: > gdf<-gdf-c("NA") plotting I get a radial tree which is correct. E(gdf) is also correct. >From the notes I understand that layout.reingold.tilford is the correct >algorithm to provide the coordinates for a traditional tree: > l<-layout.reingold.tilford(gdf) 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. When I plot this using > plot(gdf,l) I get the warning message: In if (axes) { : the condition has length > 1 and only the first element will be used and the same radial tree. What am I doing wrong? Thanks in advance Andrew _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
