Hi. I'm not 100% sure this is a bug, but it looks like it (could also be a bug in me!). I have an unrooted tree produced by iqtree2. I open it with dendropy, find a taxon node I'm interested in node = tree.find_node_with_taxon_label("name"), check the node is found assert node is not None, and then reroot at the edge of that node: tree.reroot_at_edge(node.edge).
In examining the resulting tree, I found an edge with no label on it. I wrote a tiny script to print all nodes and their edge labels (if internal) and taxon names (if not). It also prints the lengths of all edges. In a close examination of the resulting tree, I see that one of the edges of the original pseudo-root (i.e., the first node in the unrooted Newick, with valence 3) no longer has a label on it. It is the edge that leads in the direction of the root after the rerooting. I made a sketch of that part of the tree before and after the rerooting. You can see that the edge labels leading from the original pseudo-root in the direction of the edge that will be rooted on are 79, 11, and 14. After the rerooting, those labels have been assigned to edges one closer to the new root (you can see this clearly from the lengths of the edges, which are unchanged). This shifting of edge labels leaves one edge (the one labeled with 79 in the pre-rooting tree on the left in the attached image) with no label.
I took a quick look at the source to see if I could spot any problem, but didn't. I can have another look when I have more time, and can try to make a small test example to show the behavior.
I thought I would post my image here though first, to see if there are any early comments - maybe this is known or I am doing something dumb (often the case).
Thanks!

Hi. I'm not 100% sure this is a bug, but it looks like it (could also be a bug in me!). I have an unrooted tree produced by
iqtree2. I open it with dendropy, find a taxon node I'm interested innode = tree.find_node_with_taxon_label("name"), check the node is foundassert node is not None, and then reroot at the edge of that node:tree.reroot_at_edge(node.edge).In examining the resulting tree, I found an edge with no label on it. I wrote a tiny script to print all nodes and their edge labels (if internal) and taxon names (if not). It also prints the lengths of all edges. In a close examination of the resulting tree, I see that one of the edges of the original pseudo-root (i.e., the first node in the unrooted Newick, with valence 3) no longer has a label on it. It is the edge that leads in the direction of the root after the rerooting. I made a sketch of that part of the tree before and after the rerooting. You can see that the edge labels leading from the original pseudo-root in the direction of the edge that will be rooted on are 79, 11, and 14. After the rerooting, those labels have been assigned to edges one closer to the new root (you can see this clearly from the lengths of the edges, which are unchanged). This shifting of edge labels leaves one edge (the one labeled with 79 in the pre-rooting tree on the left in the attached image) with no label.
I took a quick look at the source to see if I could spot any problem, but didn't. I can have another look when I have more time, and can try to make a small test example to show the behavior.
I thought I would post my image here though first, to see if there are any early comments - maybe this is known or I am doing something dumb (often the case).
Thanks!