David Mc Dougall <dam1...@g.rit.edu> added the comment:
> If the way the user collects their data stores only successor links (which, > as above, seems odd in applications that actually use topsorts), then they > need something like this instead: Actually they only need to do this: ts = TopologicalSorter(my_forward_graph).static_order() ts = reversed(ts) I think part of the issue here is that the document uses two terms to describe the same thing: "predecessor" and "edge-direction". Everywhere it discusses predecessors it gets it right, but the edge direction is hopelessly confused because they tried to use the "normal" definition of topo-sort and the only way to make that work is to also reverse the direction of the graph's edges to compensate (and the two reversals cancel each other out). The edge direction is only mentioned twice in the whole document, once to define topo-sort and again to define the graph format. If the users problem fits into the task dependency paradigm, then this library makes a lot of sense. But for users who just have a directed graph, the documentation is really really confusing. I think it would be much better if the document explained that this was a "reversed" topological sort with a slightly different definition, and used a "bog standard" graph format like for example in this tutorial: https://www.python.org/doc/essays/graphs/ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46071> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com