Skip to content

[FEA] Generalize collapse matchers to accept kv-dict and col list #336

Description

@lmeyerov

Is your feature request related to a problem? Please describe.

Typical cases of .collapse( are acting on a dict ({'type': 'account', 'risk': 'high'}) or a col list (cols=['type'] or cols=['type', 'risk']). Currently, a manual outer loop is required: for v in g._nodes[cols].drop_duplicates()... .

Describe the solution you'd like

g2 = g.collapse('root', match=['type', 'risk'])
g2 = g.collapse('root', match={'type': 'account', 'risk': 'high'})

It should also handle the case of the root id changing..

Describe alternatives you've considered

We can also support a general udf f(n1, n2), but until we get remote mode clearer, e.g., vectorization, wait

Additional context

It may make sense to wait until we've added collapse reductions and optimized those

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions