1

There is a function within the ape library that can convert an ape phylo obj into an igraph network or a network object (from the R library network).

as.igraph(cur_Tree)

or

as.network(cur_Tree)

I'm having issues with the former:

as.igraph(cur_Tree, directed = FALSE)

Error in graph(unname(ids[t(el)]), directed = directed) : 
At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value

What's going on? Thanks in advance.

plannapus
  • 18,529
  • 4
  • 72
  • 94
laemtao
  • 147
  • 11
  • Maybe you are using an old version of `ape` and a newer version of `igraph`. Just guessing. – Gabor Csardi May 10 '14 at 22:45
  • It would be nice to also post a sufficiently reproducible example so we could run the code to see what the problem is. See [How to make a great R reproducible example?](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for more details. Without more information it's not easy to help you. – MrFlick May 11 '14 at 02:10

1 Answers1

3

Converting this tree to igraph using as.igraph() will require the following hack:

x$node.label[1] <- " "

This is because the first entry (or wherever) the node.label is == ""

laemtao
  • 147
  • 11