Re: [Neo4j] Re: Query for returning a subgraph of a particular relationship around a given node

77 views
Skip to first unread message

Michael Hunger

unread,
Jul 23, 2012, 5:28:26 PM7/23/12
to ne...@googlegroups.com
or cypher:

start n=node(400)
match p = n-[:REL*4]-m
return distinct m

for just the nodes contained in the subgraph, or 
return p

for all the paths from the start-node

Michael

Am 23.07.2012 um 20:57 schrieb Graph01:

Try gremlin. This query will return a subgraph (just the nodes) of length 4 around node 400:

g.v(400).as('origin').both('REL').dedup.loop('origin'){it.loops<=4}

You can use "aggregate" to save the edges of the subgraph.

On Monday, July 23, 2012 10:07:13 PM UTC+3, Didymus wrote:
Hi,
Let me first preface this by saying that I am new to using neo4j. I have looked a little bit into the docs and couldn't figure out a query that expresses exactly what I wanna do. I would like to know the easiest way to perform a query/queries that returns a subgraph of a particular relationship around a given node with a limit on the max length of an unconnected path (a path which doesn't connect back to the start).
Thanks

Reply all
Reply to author
Forward
0 new messages