Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsort: print nodes and cycles as they are visited #7093

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jfinkels
Copy link
Collaborator

@jfinkels jfinkels commented Jan 8, 2025

Update tsort so that

  • nodes are printed as they are visited,
  • cycles are printed as they are discovered,
  • finding a cycle doesn't terminate the traversal,
  • multiple cycles can be found and displayed.

This isn't a perfect solution, as it breaks the cycles arbitrarily and just repeats the process until it can make more progress, but is an improvement on the previous situation.

Fixes #7074

Replace custom `Node::new` function with derived `Default`
implementation, which does the same thing but more concisely.
Update `tsort` so that

* nodes are printed as they are visited,
* cycles are printed as they are discovered,
* finding a cycle doesn't terminate the traversal,
* multiple cycles can be found and displayed.

Fixes uutils#7074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tsort: fails to print all nodes to stdout when a cycle is found
1 participant