Compute topological sort with dynamic key#145
Conversation
839095b to
e6374ef
Compare
e6374ef to
e37fa88
Compare
e37fa88 to
fbe9a7a
Compare
inducer
left a comment
There was a problem hiding this comment.
Thanks for working on this! While I agree that the operation introduced here is mostly well-defined, the approach seems a bit "brutal". 🙂 The potential
| self.node = node | ||
| self.key = key | ||
| node: Any | ||
| key: Any |
There was a problem hiding this comment.
Maybe introduce type variables for key and node, for increased expressiveness of the type annotation?
| :arg trigger_key_update: A function called after scheduling a node in | ||
| *graph* that takes in an instance of :class:`TopologicalOrderState` | ||
| corresponding to the scheduling state at that point and returns whether | ||
| the comparison keys corresponding to the nodes be updated. | ||
|
|
||
| :arg get_key: A callable called when *trigger_key_update* | ||
| returns *True*. Takes in an instance of :class:`TopologicalOrderState` | ||
| and returns another callable that accepts node as an argument and returns the | ||
| comparison key corresponding to the node. |
There was a problem hiding this comment.
Couldn't this be a single callable that either performs the update or says "I've not done anything"?
fbe9a7a to
eaafc94
Compare
Closes #143.