RedisGraph / redisgraph-go

A Golang client for redisgraph
https://redisgraph.io
BSD 3-Clause "New" or "Revised" License
132 stars 38 forks source link

Adding Edges to previously created Nodes #73

Open tom342178 opened 2 years ago

tom342178 commented 2 years ago

I am updating the graph from a stream of input data. I am updating the Nodes separately from the Edges.

From what I can see, the supported pattern is that I add the nodes and the edges that connect the nodes in the same commit. I did not see a way to create a node then at a later time add an edge to a node that had already been committed without adding the node to the Node map first. If I do that, it appears as though the node would be pushed to redis again.

Am I correct?

LiorKogan commented 2 years ago

Let's first create two nodes:

graph.query g "create (x1 {n:1})"
graph.query g "create (x2 {n:2})"

Now, let's find these nodes and connect them with a new relationship:

graph.query g "match (x1 {n:1}), (x2 {n:2}) merge (x1)-[r:R]->(x2) return x1,r,x2"