Re: [Neo4j] How to return the start nodes of all the paths with Cypher

2011-11-30 Thread Andres Taylor
On Wed, Nov 30, 2011 at 9:13 AM, Michael Hunger michael.hun...@neotechnology.com wrote: what about start c=node(1) match path = c-[*]-n return NODES(path) Ouch... This is probably a rather slow query. It starts from 'c' and goes all the way out to the end of the graph for, for every path

Re: [Neo4j] How to return the start nodes of all the paths with Cypher

2011-11-30 Thread Andres Taylor
On Wed, Nov 30, 2011 at 11:32 AM, dnagir dna...@gmail.com wrote: I would probably like to write something among these lines (it's not valid query of course): START s=node(10) MATCH p = s-[:whatever]-t RETURN t, LENGTH(p) as len HAVING len = MAX( LENGTH(p) ) Well, this query would also

Re: [Neo4j] How to return the start nodes of all the paths with Cypher

2011-11-30 Thread dnagir
On 30/11/2011, at 9:46 PM, Andres Taylor [via Neo4j Community Discussions] wrote: Well, this query would also return 'b' in the example you shared above. You're right. Too late here already. Can't think clearly. I think we need something that says follow this path until you can't follow

Re: [Neo4j] How to return the start nodes of all the paths with Cypher

2011-11-30 Thread Peter Neubauer
Well, in Gremlin, it is basically scripting, so you would probably do a loop and follow the pattern until you are at the right depth, see http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-flow-algorithms-with-gremlin for a flow algo that loops until the target node = sink,

Re: [Neo4j] How to return the start nodes of all the paths with Cypher

2011-11-29 Thread Andres Taylor
Hey there, That looks like a straight forward pattern matching problem, right? START c=node(1) MATCH a--b--c, d--c, d--b--c, e--f--c RETURN a,d,e This is assuming that you have the node id of c. If not, read up how you do an index start point. Does that help? Andrés On Wed, Nov 30, 2011 at