Creating Relationship between nodes

I have a data like below

vence_andersen1_1-1662371548115.png

Here I am trying to merge all values of Alpha with all values of Beta. Example I want a relationship between a-z, a-y, a-x, a-w, a-v then b-z, b-y, b-x, b-w, b-v and so for the rest.

Can I achieve this using the queries? Thanks in advance.

One approach would be to collect both columns into lists and use a double unwind to get the Cartesian product of the two lists. This would allow you to relate each pair of elements from both lists.

Something like this:

load csv with headers from “file:///Data.csv” as line

with collect(line.Alpha) as alpha, collect(line.Beta) as beta

unwind alpha as a

merge(n:NodeType{id: a})

unwind beta as b

merge(m:NodeType{id: b})

merge(n)-[:HAS_REL]->(m)