ENH : Added get_chunks to betweenness_centrality and create_iterables in utils#29
Conversation
get_chunk kwargs to functions
get_chunk kwargs to functionsget_chunks kwarg to functions
dschult
left a comment
There was a problem hiding this comment.
I like this approach. It is general (and works for nodes, edges and isolated_nodes) and allows the user to override the choice of node chunks. I'm not sure how much difference it makes in betweenness centrality to be able to split up the "hard" nodes, but in general it will make a difference if you can split them up. And betweenness centrality could have some nodes take a lot longer than others. So this is a good one to start with.
I don't know of a way to test that this is working. Maybe you should have a test that computes it using the built-in default chunking and also computes it with a user-defined method. They could be "smoke-tests" to see if using that option breaks it so badly that smoke starts coming out. If smoke doesn't come out, it might still be wrong. But you have at least tested that there are no fundamental problems. Have you thought about tests for this?
nx_parallel/algorithms/centrality/tests/test_betweenness_centrality.py
Outdated
Show resolved
Hide resolved
|
This PR has style issues. Next time you get to it, I think it is just one line with a space at the end of the line. |
get_chunks kwarg to functionsget_chunks to betweenness_centrality and create_iterables in utils
|
It might be assuming too much to assert that the time should be less when chunking is used. But should it always be slower? How might get_chunks slow it down? |
|
That makes good sense to me. |
dschult
left a comment
There was a problem hiding this comment.
I think this is ready to be merged. So I'm approving it.
Are there any more changes planned for this PR?
Thanks @dschult ! |

Please do "Squash and merge" while merging this PR
get_chunkskwarg tobetweenness_centrality:node_chunks(instead of how we currently do it i.e. by creating partitions on theG.nodes; ifget_chunksis"chunks"(default) then this is executed). To understand the motivation for this see the additional pytest addedcreate_iterables(ref. Pr [WIP]: Refactor-- consolidate and simplify #7)