Neo4J cypher query to get nodes connected by paths with the same generic attribute -
i'm trying create cypher query returns me nodes connected given range of hops (i.e. 1..5), relationships between these hops share same attribute value, without specifying attribute.
so like
match (a {type: 'cin1'})-[rels:next*1.. {value: 1}]->(b {type: 'cancer'}) return (a), (b)
but without specifying value on edges should one, need equal among edges in hopping process.
i add upper bound path. or use (all)shortestpath(s)
also make sure a
, b
indexed label + property combination.
and can use predicate on relationships-collection forms path.
match (a:label {type: 'cin1'}) match (b:label {type: 'cancer'}) match shortestpath((a)-[rels:next*1..20]->(b)) all(r in tail(rels) (head(rels)).value = r.value) return (a), (b)
Comments
Post a Comment