This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients Dennis Sweeney, dam1784, eric.smith, python-dev, rhettinger, tim.peters
Date 2022-01-21.22:15:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642803353.72.0.577647067165.issue46071@roundup.psfhosted.org>
In-reply-to
Content
Perhaps you've overlooking something so obvious to the module authors that I haven't thought to mention it?

The purpose here is to compute a linear order. Now not even you ;-) can pretend to be confused about what "predecessor" and "successor" mean in a linear order. There's no graph involved in the final result (unless you mentally impose a trivial linear graph on the result sequence).

And that's how to view the `graph` argument _as intended_. It maps an element to the elements that must precede it _in the result_. The element's mandatory predecessors in any acceptable imposed total ordering.

From that intended view, this is just waaaay off base:

> I wish the docs started by saying:
>
> The graph is a dict of {'start_node': ['end_nodes',]}
> The topological sorter puts the end_nodes before their start_nodes.
>   [note: this is what the code currently does]

The words "start" and "end" there would be clearer as "banana" and "beeswax" ;-) End of what? Start of what? The "start" node has to appear _after_ all the "end" nodes? In what other context does the "start" appear after the "end"?

As is, the code puts the "start" node after all its declared mandatory predecessors. Exactly as the word "predecessors" suggests should happen.


[Dennis]
> David suggests:
>
> * static_order returns [A, B]
> * Conceptual/abstract directed graph direction is B --> A
> * mapping to be passed is {B: [A]}

IF that's what he's suggesting (I don't know), that's not a matter of preference, it's just plain wrong. The only possible topsort of the DAG  B --> A is the sequence [B, A]. For which see absolutely any text defining the terms.

There are many ways the "mapping to be passed" could be defined. David is certainly right that, by convention, most graphs in Python are represented by successor dicts. But he apparently doesn't want an option for the topsorter to accept such a dict either. (An irony in passing: under the covers, the class converts the predecessor-dict `graph` argument to a successor-dict representation.)

At this point, I not only don't know what he wants, his position gets less clear to me over time.
History
Date User Action Args
2022-01-21 22:15:53tim.peterssetrecipients: + tim.peters, rhettinger, eric.smith, python-dev, Dennis Sweeney, dam1784
2022-01-21 22:15:53tim.peterssetmessageid: <1642803353.72.0.577647067165.issue46071@roundup.psfhosted.org>
2022-01-21 22:15:53tim.peterslinkissue46071 messages
2022-01-21 22:15:53tim.peterscreate