@@ -3807,7 +3807,8 @@ def sort_individuals(self):
38073807 """
38083808 Sorts the individual table in place, so that parents come before children,
38093809 and the parent column is remapped as required. Node references to individuals
3810- are also updated.
3810+ are also updated. This is a stricter order than is required for a valid tree
3811+ sequence.
38113812 """
38123813 self ._ll_tables .sort_individuals ()
38133814 # TODO add provenance
@@ -3816,9 +3817,11 @@ def canonicalise(self, remove_unreferenced=None):
38163817 """
38173818 This puts the tables in *canonical* form, imposing a stricter order on the
38183819 tables than :ref:`required <sec_valid_tree_sequence_requirements>` for
3819- a valid tree sequence. In particular, the individual
3820- and population tables are sorted by the first node that refers to each
3821- (see :meth:`TreeSequence.subset`). Then, the remaining tables are sorted
3820+ a valid tree sequence. In particular, the population table is sorted to
3821+ place populations with the lowest node IDs first, and the individual table
3822+ is sorted firstly as in :meth:`.sort_individuals` and secondarily
3823+ by the lowest ID of the nodes that refer to each individual
3824+ (see :meth:`TreeSequence.subset`). The remaining tables are sorted
38223825 as in :meth:`.sort`, with the modification that mutations are sorted by
38233826 site, then time (if known), then the mutation's node's time, then number
38243827 of descendant mutations (ensuring that parent mutations occur before
0 commit comments