Is your feature request related to a problem? Please describe.
It'd be super convenient to have a graph-friendly pipeline operator, replacing a(b(c(g))) with g.pipe(c).pipe(b).pipe(a), similar to pandas and other ~monadic envs
Describe the solution you'd like
It should support transforms over nodes, edges, and graphs
Ex:
g.pipe(graph=lambda g: g.bind(x='x'))
g.pipe(lambda g: g.bind(x='x')) # shorthand
g.pipe(edges=lambda g: g._edges[['src', 'dst']]) # g in, df out
g.edges(lambda g: g._edges[['src', 'dst']]) # shorthand
g.pipe(nodes=lambda g: g._nodes[['node']]) # g in, df out
g.nodes(lambda g: g._nodes[['node']]) # shorthand
- It should be allowed to provide both
nodes=, edges=
- If both
nodes= / edges= and graph= kwargs are provided, run them in the provided order:
g.pipe(nodes=fn_1, edges=fn_2, graph=fn_3)
g.pipe(graph=fn_1, nodes=fn_2, edges=fn_3)
Describe alternatives you've considered
While we do have g.edges(df) / g.nodes(df), they do not support flows like g.cypher(...).edges(clean_fn)
Additional context
- Similar to pandas
pipe
- Most composition operators get inherited from here as they're table level
- ... Except we still don't have graph-level composition: union, subtract, ...
Is your feature request related to a problem? Please describe.
It'd be super convenient to have a graph-friendly pipeline operator, replacing
a(b(c(g)))withg.pipe(c).pipe(b).pipe(a), similar to pandas and other ~monadic envsDescribe the solution you'd like
It should support transforms over nodes, edges, and graphs
Ex:
nodes=,edges=nodes=/edges=andgraph=kwargs are provided, run them in the provided order:Describe alternatives you've considered
While we do have
g.edges(df)/g.nodes(df), they do not support flows likeg.cypher(...).edges(clean_fn)Additional context
pipe