pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

[FEA] Quickly compute multiple algorithms

Open lmeyerov opened this issue 3 years ago • 3 comments

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()

lmeyerov avatar Sep 29 '22 06:09 lmeyerov

@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.

DataBoyTX avatar Feb 07 '23 20:02 DataBoyTX

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

lmeyerov avatar Feb 08 '23 04:02 lmeyerov

Hello @lmeyerov, tried making the above mentioned changes in #436.

sky-2002 avatar Feb 08 '23 20:02 sky-2002