Search code examples
neo4jcyphergraph-databases

Multiple Relationships From One Node


Is it possible to create a node and multiple relationships from it in one cypher statement? So if I have node A the relationship would be something like:

A -> [HAS] -> B & C

Solution

  • Yes, you can do something like:

    create (a:Node {name:"A"})-[:HAS]->(b:Node {name:"B"}),
    (a)-[:HAS]->(c:Node {name:"C"})
    

    The above create statement will generate the following nodes & relationships:

    Generated nodes & relationships