Skip to content

raygard/tsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

tsort

An implementation of POSIX tsort.

See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tsort.html

This implementation performs in roughly linear time using the classic Knuth algorithm Algorithm T, Topological sort, from The Art of Computer Programming Vol 1, sec. 2.2.3.

If a cycle is detected, this program prints a single cycle to assist in resolving the problem, using the solution to Knuth sec. 2.2.3 Exercise 23. For example, given the input a b b c c a c d d e, it prints

input contains a loop:
a ->
b ->
c ->
a

It is heavily commented to show where the code corresponds with Knuth's description.

Licensed 0BSD, free for any use.

About

An implementation of POSIX tsort

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages