pygraphistry
pygraphistry copied to clipboard
[FEA] Quickly compute multiple algorithms
Is your feature request related to a problem? Please describe.
I'll often write:
g = g.compute_cugraph('weakly_connected_components')
g = g.compute_cugraph('pagerank')
g = g.compute_cugraph('betweenness_centrality')
We ought to have short-hands!
Describe the solution you'd like
Some ideas:
g.compute_cugraph(['pagerank', 'betweenness_centrality'])
g.compute_cugraph([
('pagerank', opts123),
'betweenness_centrality'
])
g.compute_cugraph(g.cugraph.node_labels)
Additional context
Same likely applies to compute_igraph()
@silkspace: I think a nice to have feature along with this would be the ability to override the fieldname is that is returned from the function, e.g. if someone already has a "pagerank" column or other that's named the same, this would give them the ability to rename the new algo column(s) that's returned.
cc @sky-2002 re: https://github.com/graphistry/pygraphistry/pull/436
agreed w/ @DataBoyTX , a cool pattern in pandas is {name: alg, ...}
ex:
compute_algs({
'pr': 'pagerank',
'bt': ('betweenness', opts123)
})
So we can update the type sig:
alg :: Union[str, List[Union[str, Tuple[str, dict]]], Dict[str, Union[str, Tuple[str,dict]]] ]
and if alg is not str, disallow setting out_col, params
Hello @lmeyerov, tried making the above mentioned changes in #436.