Re: [Neo4j] Matching exact graph pattern

2015-03-15 Thread Michael Hunger
As I said such a generic one will probably not be fast. the union all is imho fastest > Am 15.03.2015 um 17:01 schrieb Martin Troup : > > Great! So I execute: > > MATCH path=some_graph_pattern > AND ALL(n in nodes(path) WHERE id(n) IN {node_ids}) > AND ALL(r in rels(path) WHERE id(r) IN {rel_i

Re: [Neo4j] Matching exact graph pattern

2015-03-15 Thread Martin Troup
Great! So I execute: MATCH path=some_graph_pattern AND ALL(n in nodes(path) WHERE id(n) IN {node_ids}) AND ALL(r in rels(path) WHERE id(r) IN {rel_ids}) RETURN path and now I would like to know if the execution of this query is going to be fast. (I need it to be as fast as possible). In your

Re: [Neo4j] Matching exact graph pattern

2015-03-12 Thread Michael Hunger
something like this MATCH path=(n)-[*..5]-() where id(n) = {node_ids}[0] AND ALL(n in nodes(path) WHERE id(n) IN {node_ids}) AND ALL(r in rels(path) WHERE id(r) IN {rel_ids}) return path > Am 10.03.2015 um 22:40 schrieb Martin Troup : > > Thanks for your reply! > > So let me change the prob

Re: [Neo4j] Matching exact graph pattern

2015-03-10 Thread Martin Troup
Thanks for your reply! So let me change the problem a little bit. Let say I know all of the nodes and relationships (its IDs) where I want to search for a pattern (for example triangle). Can I define a cypher query with MATCH clause, that will find a triangle (or any graph pattern) between t

Re: [Neo4j] Matching exact graph pattern

2015-03-10 Thread Michael Hunger
There is no universal way this is a quite generic approach but it will be super slow MATCH path = (a)-[]-(b)-[]-(c) WHERE ANY(r in rels(path) WHERE id(r) = 5) RETURN path it is better if you can do: match path = (a)-[r]-(b)-[]-(c) where id(r) = 5 return path union match path = (a)-[]-(b)-[r]-(c

[Neo4j] Matching exact graph pattern

2015-03-10 Thread Martin Troup
Hello everyone, lets say I have a graph pattern (for example (a)-[]-(b)-[]-(c), but it can be any graph pattern). I want to find this graph pattern with Cypher query. I know partial information about the exact pattern I am looking for, for example some of node IDs, or relationship IDs. Her