gradoop icon indicating copy to clipboard operation
gradoop copied to clipboard

Use pattern matching for subgraph operation

Open s1ck opened this issue 8 years ago • 0 comments
trafficstars

Just an idea for a convenience function that I'm sketching down here:

Subgraph is basically a pattern match, formulated like so:

MATCH (n)-[e]->(m)
WHERE vertexPredicate(n) AND vertexPredicate(m) AND edgePredicate(e)

subgraph could be called like so:

graph.subgraph("WHERE vertex.prop = 'foo' and label(edge) = 'knows'")

which gets translated into

MATCH (vertex1)-[edge]->(vertex2)
WHERE (vertex1.prop = 'foo') AND (vertex2.prop = 'foo') AND (label(edge) = 'knows')

The reduced combination of the resulting graph collection is equivalent to the result of the subgraph call.

s1ck avatar Oct 07 '17 08:10 s1ck