Repository navigation
Added "initial_node" param to generate_random_paths() to allow a starting node to be specified for generated walks - #8002
Conversation
…ng node to be specified for all generated paths.
| index_map=None, | ||
| weight="weight", | ||
| seed=None, | ||
| initial_node=None, |
There was a problem hiding this comment.
Thanks @khughitt !
In most of the networkx algorithms, the starting node is referred to as source.
| initial_node=None, | |
| source=None, |
Also, we can consider adding a target (ending node) parameter here too. btw, not a blocker for this PR :)
There was a problem hiding this comment.
Thanks! That's good to know.
I also tried to keep seed at the end of the args -- not always the case in networkx, but often the case -- but I ran into issues possibly relating to the dispatcher logic and eventually settled for adding the new arg at the end.
There was a problem hiding this comment.
Can we please make this new arg keyword-only. We won't do that for the existing keywords, but new keywords shouldn't be referred to by position. So put an argument *, just before the source=None line.
Co-authored-by: Aditi Juneja <[email protected]>
dschult
left a comment
There was a problem hiding this comment.
This looks good to me. And it seems like a reasonable feature.
Question for you: Are you adding this as a helpful tool for panther similarity? Or are you using generate_random_paths without regard to panther similarity? Thanks!
|
I am adding this for it's own sake. I wasn't actually aware of panther similarity until this discussion / running the tests for the PR, so that was a pleasant discovery :) |
|
Thanks for that feedback. We have an issue #8005 which is considering making this function more prominent and perhaps more aligned with what folks that need it would like. Constructing random walks seems like something we should provide more easily. If you have ideas or suggestions we'd like to hear them :) |
Small modification to allow the user to specify an initial node to begin all walks from.