hammadsaleemm commented on issue #918:
URL: https://github.com/apache/age/issues/918#issuecomment-1546865311

   Yes, you can use a single Cypher query to add multiple edges at a time in 
Neo4j graph database. The Cypher query language provides several ways to create 
multiple edges efficiently. My take is on UNWINDIND
   
   One common way is to use the UNWIND clause to create multiple edges at once 
from a collection of edge properties. Here is an example: `UNWIND [{source: 1, 
target: 2}, {source: 2, target: 3}, {source: 3, target: 1}] AS edge
   MATCH (s:Node {id: edge.source}), (t:Node {id: edge.target})
   CREATE (s)-[:CONNECTS_TO]->(t)
   `
   In this example, the UNWIND clause unpacks a list of edge properties, each 
containing the source and target nodes' ids. The MATCH clause finds the 
corresponding nodes in the graph, and the CREATE clause creates the CONNECTS_TO 
relationship between them.
   
   You can modify this query to add any other properties to the edges as 
needed. You can also adjust the MATCH clause to use different node labels or 
property names, depending on your graph's schema.
   
   Note that adding multiple edges at once can still be slow if you have a 
large number of nodes or edges. In that case, you may want to consider using 
bulk import tools or using Neo4j's apoc library to optimize the import process.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to