Skip to content

Provide a simple function interface for topological sort in graphlibΒ #125181

@erezsh

Description

@erezsh

Feature or enhancement

Proposal:

The graphlib interface requires 5 function calls in order to get the result of a topological sort.

I believe that the most common user will most likely only need a single function call, i.e.

def topological_sort(graph: dict) -> Iterable[set]: ...

I propose adding this small utility function to graphlib.

Note: there is static_order(), which reduces it to 2 function calls, but it flattens the result, which is a bad default.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions