[issue17005] Add a topological sort algorithm

Pablo Galindo Salgado report at bugs.python.org
Wed Jan 16 21:12:11 EST 2019


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

The one in PR 11583 is twice as faster:

>timeit for -> topsort([(2,11),(9,11),(9,8),(9,10),(10,11),(10,3),(11,7),(11,5),(8,7),(8,3)])
12.4 µs ± 59.1 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

>timeit for -> tsort([(2,11),(9,11),(9,8),(9,10),(10,11),(10,3),(11,7),(11,5),(8,7),(8,3)])
29.1 µs ± 147 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

----------
nosy: +pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue17005>
_______________________________________


More information about the Python-bugs-list mailing list