Closed hyanwong closed 11 months ago
Ah yeah, that function is definitely not working how I intended. Thank you for noticing that. It should be fixed with the latest commit to main. The new version will now update the label of any node in the D3ARG with "id" 20 to "". Technically, "id" should always be a unique field so only one node should be updated (though there aren't any checks implemented for this at the moment). If you pass in an "id" that doesn't exist in the D3ARG, the function ignores it and continues with the other nodes. Lastly, node labels are now consistently strings, rather than a mix of strings and ints.
For an ARG with nodes marked as
msprime.NODE_IS_RE_EVENT
, the node IDs are not the same as the index into the nodes list. When you calld3arg.set_node_labels({id1: "lab1", id2: "lab2"})
, rather than using the node IDs, the key seems to be an index into the list of nodes. For instance, in the d3arg below, the node with id 20 is actually number 16 in the list: