Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
Attaching some of my 2013 work on this. Here are some API notes: * spell-out the name topological_sort() * allow input as ordered pairs like the Unix tsort command https://en.wikipedia.org/wiki/Tsort#Examples * allow more convenient input as dependency sequences (like graphviz): [['a', 'b', 'c', 'x], ['b', 'd', 'e', 'y']] is short for and equivalent to: [(a,b), (b,c), (c,x), (b,d), (d, e), (e, y)] * return both the sorted sequence and cycles (both are individually useful and the latter is helpful in debugging in only the former is wanted) * desire to match the C3 MRO computation * would like the ordering to be stable and deterministic (this precludes picking arbitrary elements from sets). ---------- Added file: https://bugs.python.org/file48361/topological_sort.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue17005> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com