Skip to content

sort should ensure ordering of individual parents (also, mutation parents?) #1197

Closed

Description

@petrelharp

sort( ) should produce valid tables; with #1192 one of the requirements not ensured by sort is that parent individuals come before children. We should do this! Also, I think we should do the same for mutations. (I'm only proposing sorting so that mutations who have their parent mutations specified get sorted correctly; otherwise we'd have to compute the mutation parents.)

Since sort is a bottleneck in forwards sims, and this sortedness is not required by simplify, perhaps this should be optional. (although it sounds annoying to make it optional)

Activity

  1. jeromekelleher commented on Feb 11, 2021

    @jeromekelleher
    Member

    Agreed. But:

    Since sort is a bottleneck in forwards sims, and this sortedness is not required by simplify, perhaps this should be optional. (although it sounds annoying to make it optional)

    I think edge sorting is the bottleneck, right? All the rest is pretty small fry compared to the large edge tables, so adding a few constant factors isn't going to make any difference. I would vote for doing it the way we think is right first, and then backing out an making it optional if it turns out to add to sort-time in forward sims.

  2. added this to the C API 0.99.11 milestone on Feb 11, 2021
  3. benjeffery commented on Feb 12, 2021

    @benjeffery
    Member

    I'm going to have a stab at this, @jeromekelleher and I just talked it over and sorting individuals is equivalent to topologically sorting the directed graph of parent references. Kahn's algorithm looks promising for this, it also will detect cycles in the graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions