Python 3.9 graphlib review

1 Like

Could you add some details around why you’re posting this and what responses you’re looking for, so it doesn’t come across as just spam?

I also think you are over-using the static_order method. That is provided so users have a easy way to obtain some linearisation (for convenience), but if you want more control you must use the other methods in the class. For instance, to have the same output as your previous sorting you can do:

>>> ts = TopologicalSorter(data)
>>> ts.prepare()
>>> result = []
>>> while ts.is_active():
...     new_items = set(ts.get_ready())
...     for x in new_items:
...         ts.done(x)
...     result.append(new_items)
>>> result
[{'std', 'synopsys', 'ieee'}, {'std_cell_lib', 'ramlib', 'gtech', 'dware'}, {'dw06', 'dw02', 'dw05', 'dw07', 'dw01'}, {'dw03', 'des_system_lib', 'dw04'}]

which is equivalent to your previous output:

({'synopsys', 'std', 'ieee'},
 {'dware', 'ramlib', 'gtech', 'std_cell_lib'},
 {'dw07', 'dw02', 'dw06', 'dw01', 'dw05'},
 {'des_system_lib', 'dw04', 'dw03'})

In any case, if you think we should consider some modification or improvement, this is not the best forum. The best place would be commenting your use case and request for improvements in the issue:


Thanks. I may have been premature…

Not intentionally spam. My apologies if so construed.