@@ -3810,7 +3810,8 @@ def sort_individuals(self):
38103810 """
38113811 Sorts the individual table in place, so that parents come before children,
38123812 and the parent column is remapped as required. Node references to individuals
3813- are also updated.
3813+ are also updated. This is a stricter order than is required for a valid tree
3814+ sequence.
38143815 """
38153816 self ._ll_tables .sort_individuals ()
38163817 # TODO add provenance
@@ -3819,9 +3820,11 @@ def canonicalise(self, remove_unreferenced=None):
38193820 """
38203821 This puts the tables in *canonical* form, imposing a stricter order on the
38213822 tables than :ref:`required <sec_valid_tree_sequence_requirements>` for
3822- a valid tree sequence. In particular, the individual
3823- and population tables are sorted by the first node that refers to each
3824- (see :meth:`TreeSequence.subset`). Then, the remaining tables are sorted
3823+ a valid tree sequence. In particular, the population table is sorted to
3824+ place populations with the lowest node IDs first, and the individual table
3825+ is sorted firstly as in :meth:`.sort_individuals` and secondarily
3826+ by the lowest ID of the nodes that refer to each individual
3827+ (see :meth:`TreeSequence.subset`). The remaining tables are sorted
38253828 as in :meth:`.sort`, with the modification that mutations are sorted by
38263829 site, then time (if known), then the mutation's node's time, then number
38273830 of descendant mutations (ensuring that parent mutations occur before
0 commit comments