Hacker News new | ask | show | jobs
by gradys 1900 days ago
Why is the no diamond constraint useful here?
1 comments

Without it, the structure allowed the user to create a graph like this:

    [x] Task
     ├──[x] Sub-task (1)
     │   ├──[x] Sub-sub-task (2)
     │   └──[x] Sub-sub-task
     ├──[x] Sub-task (3)
     │   ├──[x] Sub-sub-task (2)
     │   └──[x] Sub-sub-task
     └──[x] Sub-task
by creating a link from (3) to (2). The tree command would actually omit the second occurrence of (2), since the algorithm visited each node just once.