matsengrp / historydag

https://matsengrp.github.io/historydag
GNU General Public License v3.0
0 stars 1 forks source link

adding new sequences to a pre-existing DAG (no relabeling) #35

Closed marybarker closed 2 years ago

marybarker commented 2 years ago

Adds 2 routines to insert new leaf sequences to an internally labelled dag. insert_node_at_all_possible_places adds the new node as a new child of every internal node in the dag. insert_node adds the new node as a child of the closest labelled node in the dag if that node is internal, or as a sibling if that node is a leaf. In order to ensure that every resulting tree in the dag contains the new node, this routine then iterates through the nodes that cannot be in the same tree as the first choice of internal node, and adds the new node as a child to the closest node. This process is repeated until every tree is guaranteed to contain the new node.

willdumm commented 2 years ago

I'm not sure if what I changed really helped, but there it is!