Reputation: 25
I want to link the Third or Last node with the first node using a Cypher query. Here is my query for two nodes.
CREATE (s1:subject1 {name:'Ali'})-[:went_to]->(o1:object{name: 'Islamabad'})
Upvotes: 0
Views: 30
Reputation: 4052
Adding to @Muldec's Answer.
You can separately create nodes and relationships to make it simple.
CREATE (s1:subject {name:'Ali'}),
(o1:object {name: 'Islamabad'}),
(o2:object {name: 'Islamabad-2'}),
(s1)-[:went_to]->(o1),
(s1)-[:went_to]->(o2);
Upvotes: 1
Reputation: 4901
Here are some solutions :
CREATE (n1:node)-[:rel]->(n2:node)-[:rel]->(n3:node), (n1)-[:rel]->(n3)
or
CREATE (n1:node)-[:rel]->(n2:node), (n1)-[:rel]->(n3:node)
depending of what you want to do
Upvotes: 0