This is one of the first steps towards implementing #6.
Given a history DAG $G$ and a history $t$ on the same leaves, but with $t$ possibly not a history in $G$, we'd like to be able to merge a sub-structure $s$ of $t$ into $G$ for which:
$s$ is connected
$s$ may contain any number of internal nodes and/or leaf nodes
all nodes in $s$ with neighbors not in $s$ (which we'll call 'boundary nodes of $s$') are already in $G$.
Here's a picture showing the history $t$ on the left, and on the right side, such a sub-structure $s$ is highlighted in yellow, with blue arrows pointing to the boundary nodes:
Merging a structure like $s$ will be (in theory) straightforward:
all of the boundary nodes of $s$ already exist inside the DAG, so only non-boundary nodes of $s$ may need to be created if they're not already in the DAG.
Since the boundary nodes define where $s$ gets patched into the DAG, there's no confusion about what other edges to add: we only need to add the edges between nodes in $s$.
This fits in with #6 because given a move, we'd like to be able to produce a sub-structure like $s$ from the (hypothetical) tree resulting from applying only that move. This small sub-structure will contain all the nodes which are different (have different child clade sets or compact genomes) as a result of applying the move. Since this sub-structure will be much smaller than the entire tree, we'd like to be able to produce only the sub-structure, and merge it into the hDAG, as part of the move callback.
This is one of the first steps towards implementing #6.
Given a history DAG $G$ and a history $t$ on the same leaves, but with $t$ possibly not a history in $G$, we'd like to be able to merge a sub-structure $s$ of $t$ into $G$ for which:
Here's a picture showing the history $t$ on the left, and on the right side, such a sub-structure $s$ is highlighted in yellow, with blue arrows pointing to the boundary nodes:
Merging a structure like $s$ will be (in theory) straightforward:
This fits in with #6 because given a move, we'd like to be able to produce a sub-structure like $s$ from the (hypothetical) tree resulting from applying only that move. This small sub-structure will contain all the nodes which are different (have different child clade sets or compact genomes) as a result of applying the move. Since this sub-structure will be much smaller than the entire tree, we'd like to be able to produce only the sub-structure, and merge it into the hDAG, as part of the move callback.