You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment: Ubuntu 20.04, uutils main branch (git commit 20b5365), GNU coreutils v8.30
Steps to reproduce: run topological sort on a graph that has a cycle, like this:
# the graph looks like: a --> b <==> c --> d
printf "a b\nb c\nc b\nc d\n" | tsort
What happens now: uutils tsort prints the cycle to stderr, but does not print the "best effort" ordering of the nodes to stdout:
tsort: -: input contains a loop:
tsort: b
tsort: c
b
c
(The first three lines are on stderr, the next two lines are on stdout.)
What I expected to happen: GNU tsort prints the cycle to stderr when it is discovered during graph traversal, but then continues the traversal and prints all the nodes to stdout:
a
tsort: -: input contains a loop:
tsort: b
tsort: c
b
c
d
Notes: this is causing a failure in the GNU test file tests/misc/tsort.pl.
The text was updated successfully, but these errors were encountered:
# The graph looks like this:
#
# a
# |
# V
# c <=> b <=> d
#
$ printf "a b b c c b b d d b" | tsort
a
tsort: -: input contains a loop:
tsort: b
tsort: c
tsort: -: input contains a loop:
tsort: b
tsort: d
b
d
c
I'm not sure how it decides which edge to delete to break the loops.
jfinkels
added a commit
to jfinkels/coreutils
that referenced
this issue
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.
Fixesuutils#7074
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.
Fixesuutils#7074
jfinkels
added a commit
to jfinkels/coreutils
that referenced
this issue
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.
Fixesuutils#7074
Uh oh!
There was an error while loading. Please reload this page.
Environment: Ubuntu 20.04, uutils main branch (git commit 20b5365), GNU coreutils v8.30
Steps to reproduce: run topological sort on a graph that has a cycle, like this:
What happens now: uutils
tsort
prints the cycle to stderr, but does not print the "best effort" ordering of the nodes to stdout:(The first three lines are on
stderr
, the next two lines are onstdout
.)What I expected to happen: GNU
tsort
prints the cycle to stderr when it is discovered during graph traversal, but then continues the traversal and prints all the nodes to stdout:Notes: this is causing a failure in the GNU test file
tests/misc/tsort.pl
.The text was updated successfully, but these errors were encountered: