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 those defined relationships and nodes? The problem in general would be to execute a cypher query on a subgraph that I define (by naming all of nodes and relationships IDs). So I am looking for something like: MATCH any_graph_pattern IN (node_id_4, node_id_3, … , relationship_id_1, …) If there is such a way to express this with Cypher, is the execution of the query going to be fast enough? If the subgraph where I am looking for the graph pattern is going to be small enough. Thanks again for your time! Martin Dne úterý 10. března 2015 11:31:10 UTC+1 Michael Hunger napsal(a): > > 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) > where id(r) = 5 > return path > > Michael > > Am 10.03.2015 um 11:24 schrieb Martin Troup <trou...@gmail.com > <javascript:>>: > > 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. > > Here I will show an example. I am looking for a pattern (a)-[]-(b)-[]-(c) > and I know there is a relationship with ID 5 in it, but I don’t know its > position. So it can be the one between nodes a and b or between b and c. > > I am wondering if there is an universal way to express this with Cypher > query, something like > > > MATCH any_graph_pattern > > WHERE relationship_id(5) > > > where I can say which exact relationships or nodes are part of the graph > pattern I am looking for even though I don’t know their position within it. > > > Thanks a lot for a reply! > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+un...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.