Generate random genealogies backward in time—add population structure to see migration and coalescence
The coalescent is a backward-time view of population genetics. Instead of tracking alleles forward through generations (as in Wright-Fisher models), we trace sampled lineages backward to their most recent common ancestor (MRCA).
In a large population of size N, when we trace k lineages backward in time, the probability that two lineages coalesce in the previous generation is approximately k(k-1)/(4N). The time until the next coalescent event follows an exponential distribution with rate k(k-1)/(4N).
The Wright-Fisher model simulates allele frequencies forward in time through discrete generations with random mating. The coalescent emerges as the limiting genealogical process when N is large. Enable the Wright-Fisher comparison to see how forward-time sampling produces similar genealogical structures.