3 ms·
Hm this reminds me that the Python stdlib has grown a module for topological sorting fo a graph: https://docs.python.org/3/library/graphlib.html https://docs.p
by chubot 2y ago
Hm this reminds me that the Python stdlib has grown a module for topological sorting fo a graph:
https://docs.python.org/3/library/graphlib.html https://docs.python.org/3/library/graphlib.html
I haven't used it yet, I'd be curious if anyone has
- nerdponx 2y agoI used it to build a (now permanently unfinished) lightweight DAG runner that uses only the Python standard library, with the intention that you can just copy the .py file into a project and use it without installing anything other than Python on your system. I think it might be of niche use to some people, but I personally wasn't even dogfooding it, I was just scratching an itch. The purpose of adding it to the standard library was to implement linear MRO for classes: https://bugs.python.org/issue17005 https://bugs.python.org/issue17005
- jessekv 2y agoI built one too! I started with networkx but migrated to graphlib with python 3.9. I run it in production for many customers. It's great to have this in the std lib.
- paulddraper 2y agoIt’s a common algorithmic need. Not as common as array sort. But still common.