{'fraction_non_alphanumeric': 0.01700251889168766, 'fraction_numerical': 0.0, 'mean_word_length': 6.157657657657658, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
How mechanisms of habitat preference evolve and promote divergence with gene flow

Habitat preference may promote adaptive divergence and speciation, yet the conditions under which this is likely are insufficiently explored. We use individual‐based simulations to study the evolution and consequence of habitat preference during divergence with gene flow, considering four different underlying genetically based behavioural mechanisms: natal habitat imprinting, phenotype‐dependent, competition‐dependent and direct genetic habitat preference. We find that the evolution of habitat preference generally requires initially high dispersal, is facilitated by asymmetry in population sizes between habitats, and is hindered by an increasing number of underlying genetic loci. Moreover, the probability of habitat preference to emerge and promote divergence differs greatly among the underlying mechanisms. Natal habitat imprinting evolves most easily and can allow full divergence in parameter ranges where no divergence is possible in the absence of habitat preference. The reason is that imprinting represents a one‐allele mechanism of assortative mating linking dispersal behaviour very effectively to local selection. At the other extreme, direct genetic habitat preference, a two‐allele mechanism, evolves under restricted conditions only, and even then facilitates divergence weakly. Overall, our results indicate that habitat preference can be a strong reproductive barrier promoting divergence with gene flow, but that this is highly contingent on the underlying preference mechanism.