Figure 5: Free gene flow despite assortative mating. If mating cues are environmentally induced but there is no habitat choice, host-associated populations will not be genetically differentiated, and it takes two generations to establish Hardy-Weinberg equilibrium. If the host densities are and , a locus that is fixed for different alleles on different hosts has allele frequencies and . At first, genotypes are perfectly associated with the host-induced mating cue, but random dispersal eliminates that association in one generation if there are no other factors maintaining covariance between parent and offspring phenotype (e.g., maternal effects or divergent selection). Once genotype frequencies are equalized between phenotypes, mating within phenotypes establishes Hardy-Weinberg genotype proportions . Although imagining a locus with complete differentiation makes for the simplest illustration, the result is completely general for any allele frequency. If we somehow know what alleles have ancestors in each habitat in generation 0, the result is that it takes just two generations to completely randomize that ancestry, regardless of whether or not the alleles are actually different by state.