Type Definition forrustts::EdgeBuffer [−][src]
type EdgeBuffer = NestedForwardList<Segment>;
Data type used for edge buffering.
Simplification of simulated data happens
via crate::simplify_from_edge_buffer()
.
Overview
The typical tree sequence recording workflow goes like this. When a new node is “born”, we:
- Add a new node to the node table. This new node is a “child”.
- Add edges to the edge table representing the genomic intervals passed on from various parents to this child node.
We repeat 1
and 2
for a while, then
we sort the tables
.
After sorting, we simplify
the tables.
We can avoid the sorting step using this type.
To start, we record the list of currently-alive nodes
here
.
Then, we use parent
ID values as the
head
values for linked lists stored in a
NestedForwardList
.
By its very nature, offspring are generated by birth order.
Further, a well-behaved forward simulation is capable of calculating
edges from left-to-right along a genome. Thus, we can
extend
the data for each chain with Segment
instances representing
transmission events. The segment’s node
field represents
the child.
After recording for a while, we call
simplify_from_edge_buffer
to simplify
the tables. After simplification, the client code must re-populate
the list
of alive nodes.
Once that is done, we can keep recording, etc..
Example
For a full example of use in simulation,
see the source code for
wright_fisher::neutral_wf