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, without

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 Andres Taylor
On Wed, Nov 30, 2011 at 11:32 AM, dnagir 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 return

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

2011-11-30 Thread dnagir
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) ) Seems like clause similar to SQL HAVING is missing. It doesn't "exactly" reflect what I want but jus

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 10:59 AM, Dmytrii Nagirniak wrote: > Yes, but I don't know the exact paths. Those were just examples. And the > depth may be higher than 10. So I can't hardcode it into the query. Ah, now I understand. Sorry about the mix-up... This is a weak area for Cypher right now. I

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

2011-11-30 Thread Dmytrii Nagirniak
Yes, but I don't know the exact paths. Those were just examples. And the depth may be higher than 10. So I can't hardcode it into the query. On Nov 30, 2011 6:33 PM, "Andres Taylor" wrote: > Hey there, > > That looks like a straight forward pattern matching problem, right? > > START c=node(1) > M

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 ev

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

2011-11-30 Thread Michael Hunger
what about start c=node(1) match path = c<-[*]->n return NODES(path) Returns the end nodes of your paths. HTH Michael Am 30.11.2011 um 08:33 schrieb Andres Taylor: > Hey there, > > That looks like a straight forward pattern matching problem, right? > > START c=node(1) > MATCH a-->b-->c, d--

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, 20

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

2011-11-29 Thread dnagir
Hi, How can I find all the nodes that "start a path" So that I start at node "c" and paths "a->b->c", "d->c", "d->b->c", "e->f->c" I want to retrieve nodes "a", "d" and "e". -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/How-to-return-the-start-nod