-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute topological sort with dynamic key #145
base: main
Are you sure you want to change the base?
Compute topological sort with dynamic key #145
Conversation
839095b
to
e6374ef
Compare
e6374ef
to
e37fa88
Compare
e37fa88
to
fbe9a7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
pytools/graph.py
Outdated
self.node = node | ||
self.key = key | ||
node: Any | ||
key: Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.