Skip to content

timeasc/timedesc node orderings only hold *within* a particular root #1776

Closed

Description

@jeromekelleher

If we have two disconnected subtrees in a tree, the tree.nodes(order="timeasc") function currently visits nodes in one subtree first in time order, then the other.

It would be more consistent and logical if all nodes in the tree were visited in time order.

Activity

  1. added
    bug
    on Oct 9, 2021
  2. added this to the Python 0.3.8 milestone on Oct 9, 2021
  3. jeromekelleher commented on Oct 9, 2021

    @jeromekelleher
    MemberAuthor

    Also we're currently defining it like this:

    self.nodes(u, order="levelorder"), key=lambda u: (self.time(u), u) 
    

    which means we sort by time first then by node ID. I would have thought it simpler/more logical to leave the natural preorder tree ordering within a node. (The "levelorder" isn't needed either, since we're totally ordering)

  4. jeromekelleher commented on Oct 9, 2021

    @jeromekelleher
    MemberAuthor

    Also true for levelorder.

  5. benjeffery commented on Oct 11, 2021

    @benjeffery
    Member

    All the sorting methods go root-by-root, I assume for the others this is OK as they are topological.

  6. jeromekelleher commented on Oct 11, 2021

    @jeromekelleher
    MemberAuthor

    I'm working through traversal semantics right now as part of #1704 - I think it'll be easiest to change it to be global rather than per root. This will be a good time to change it, since we'll be doing the virtual root as part of 0.4.0

  7. added 9 commits that reference this issue on Oct 11, 2021
    b70e8a1
    e483f80
    fa24a27
    5055ac2
    218fd6f
    fcc5ea0
    5fb52f8
    e2fce13
    a0af17b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions