My neo4j graph shows like below..
300 is connected to 100 and 100 is connected to 201 and 400.
I want to find out the 2nd level of connectivity in neo4j.
For example: the 2nd level of node for 300 should return me 201 and 400
Is it possible in neo4j?
when I use below cypher query:
MATCH (n)-[:CALLED*2]-(result) WHERE n.name = '300' RETURN result
It should give me only 201 and 400 ,but it return like below
The standard store format of neo4j allows for 65k different relationship types.
Properties are stored as a linked list of property records, each holding a key and value and pointing to the next property. Each node and relationship references its first property record. The Nodes also reference the first relationship in its relationship chain. Each Relationship references its start and end node.
Return all elements When you want to return all nodes, relationships and paths found in a query, you can use the * symbol.
This is very easy in Neo4j. If you're using Cypher it might be something like:
MATCH (n)-[:CALLED]-()-[:CALLED]-(result)
WHERE n.id = 300
RETURN result
I'm assuming here that the id
property is what is holding the identifying numbers, but obviously you can change that.
You can even do variable length paths like this:
MATCH (n)-[:CALLED*2]-(result)
WHERE n.id = 300
RETURN result
Part of the problem here, though, is that this will return node #200. One query that would fit the result your looking for is:
MATCH (n)-[:CALLED]->()<-[:CALLED]-(result)
WHERE n.id = 300
RETURN result
This matches only where the middle node has the relationships pointing to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With