Closed ArtPoon closed 5 years ago
This occurs for computing the kernel score of the tree against itself. n1
and n2
are both 16. This occurs because V(g1)$children[[n1]]
returns the value integer(0)
.
n1
is an internal node. The children
vector should have meaningful values for this node, not integer(0)
. This is happening because the ordering of nodes in children
does not match the numbering of nodes in the tree.
> reorder(tree, order='postorder', index.only=T)
[1] 35 36 34 37 29 30 28 31 24 25 21 22 20 23 19 26 15 16 14 17 9 10 8 11 7
[26] 12 6 13 5 18 4 27 3 32 2 33 1 38
> sapply(.get.children(g), length)
[1] 2 2 2 2 2 2 2 2 2 0 0 0 0 2 2 0 0 0 2 2 2 0 0 2 0 0 0 2 2 0 0 0 0 2 2 0 0 0
[39] 0
Let's try reordering the tree as the first step in .tree.to.igraph
. Then:
> sapply(.get.children(g), length)
[1] 2 0 0 2 0 2 0 0 2 0 2 0 0 2 0 0 2 2 0 2 0 0 2 0 2 0 0 2 0 2 0 2 2 2 2 0 2 2
[39] 0