title: Neo4j-how to create nodes from two columns of CSV file with single MERGE?
body: <p>I am using following code to create a graph  </p>
  
  <pre><code>LOAD CSV WITH HEADERS 
  FROM "file:///fileName.csv"  
  AS network
  MERGE (n:sourceNode {id:network.node1})
  MERGE (m:destNode {id:network.node2})
  WITH n,m,network
  CALL apoc.create.relationship(n, network.connection, {}, m) yield rel
  RETURN n, 
  rel, 
  m  
  </code></pre>
  
  <p>They CSV file contains repeating values like  </p>
  
  <pre><code>node1,connection,node2
  A,0.75,B  
  c,0.5,A
  </code></pre>
  
  <p>this code creates a graph like this <a href="https://i.stack.imgur.com/6FRJ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6FRJ8.png" alt="graph1"></a><br>
  But I need graph like following to perform analysis<a href="https://i.stack.imgur.com/J1Fnk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J1Fnk.png" alt="graph2"></a><br>
  one solution I came up with is that I can create both 
  <code>node1</code> and <code>node2</code> with single <code>MERGE</code> clause as it will create non-repeating node. I have tried to modify this code like </p>
  
  <pre><code>MERGE (n:sourceNode {id:network.node1}, m:destNode {id:network.node2})  
  </code></pre>
  
  <p>and others but I get syntax error. Can some please me out with this situation? or has any other solution to this problem?</p>