toposort#

Topological sorting implementation.

Functions#

_toposort(data)

Dependencies are expressed as a dictionary whose keys are items

pop_key(data)

Pop an item from the graph that has the fewest dependencies in the case of a tie

_safe_toposort(data)

Dependencies are expressed as a dictionary whose keys are items

toposort(data[, safe])

_toposort(data)#

Dependencies are expressed as a dictionary whose keys are items and whose values are a set of dependent items. Output is a list of sets in topological order. The first set consists of items with no dependences, each subsequent set consists of items that depend upon items in the preceding sets.

pop_key(data)#

Pop an item from the graph that has the fewest dependencies in the case of a tie The winners will be sorted alphabetically

_safe_toposort(data)#

Dependencies are expressed as a dictionary whose keys are items and whose values are a set of dependent items. Output is a list of sets in topological order. The first set consists of items with no dependencies, each subsequent set consists of items that depend upon items in the preceding sets.

toposort(data, safe=True)#