Reputation: 1685
In my database, I can extract subgraphs by using a native Neo4J traversal that looks a little like this:
TraversalDescription td = Traversal.description()
.depthFirst()
.relationships(Relation.REL1, Direction.OUTGOING)
.relationships(Relation.REL2, Direction.OUTGOING);
And it works like a charm. Now I would like to do one of two things, but I'm expecting the latter to be a little easier.
When I say store the traversal as a graph object, what I actually mean is that I want every single node that I passed by during that traversal (so not only the leaf nodes) to be stored in such a graph object and then I want every relation of which both start and endnode exist in the new graph object to be created. That includes relations that I did not include in my traversal description.
Upvotes: 1
Views: 822
Reputation: 6331
I think something like g.outE.filter{it.label == "REL1" || it.label == "REL2"}.inV.loop(3)
or so?
Upvotes: 1