-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Handle weights as distance=
in testing dispatch
#6671
Conversation
@eriknw This was always a hack, and you're finding the rough edges. I was really hoping to not force every backend algorithm to check if the input is Now that NetworkX handles multiple graphs (G, H) in the same call, this only gets more complicated. I vote to throw away the hacks and pass Finally, if we're making this change for |
I also don't want to effectively require backends to return a networkx return type (such as What do you think about adding e.g. I'm also envisioning a future where we have a top-level configuration for e.g. auto-converting and dispatching, and also per-algorithm configuration that you can manipulate via e.g. These are longer conversations to be had. For now, I think we can continue as done in this PR. Indicating the weight with |
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.
I still think we should revisit this so it doesn't become hacks built upon hacks as we build out the dispatching coverage. But I'm okay with this change for now to not lose momentum.
This change was suggested here: python-graphblas/graphblas-algorithms#62 (comment)
* Handle weights as `distance=` in testing dispatch * fix `test_intersection` This change was suggested here: python-graphblas/graphblas-algorithms#62 (comment)
* Handle weights as `distance=` in testing dispatch * fix `test_intersection` This change was suggested here: python-graphblas/graphblas-algorithms#62 (comment)
* Handle weights as `distance=` in testing dispatch * fix `test_intersection` This change was suggested here: python-graphblas/graphblas-algorithms#62 (comment)
This handles
ego_graph
, which I just implemented ingraphblas-algorithms
here: python-graphblas/graphblas-algorithms#61This
dispatch
function is only used when testing, and it automatically converts graph inputs to the backend specified in an environment variable (it also converts Graph outputs back to networkx graphs). To convert correctly, it needs to know which weight to use for each algorithm. To date, this has worked fairly well by using a small set of rules. As done in this PR, these rules will likely need to be updated as more and more algorithms support dispatch. Some thoughts:weight_argument="distance"
to the@dispatch
decorator to indicate which argument should be used as the weight argument. Sooner or later, we probably ought to make@dispatch
return an instance of a class instead of relying on closures.CC @jim22k @MridulS