I want to split the graph into two sets, train and test. For each node, add an additional node label, either 'train' or 'test'. For example, 1/3 goes to 'test' and 2/3 goes to 'train'. Is is possible to do this with a cypher in neo4j?
MATCH (n)
WITH count(n) as total
UNWIND range(1,total) as range
WITH toInteger(rand() * (total - 1 + 1)) + 1 as randomID
WHERE ID(n) = randomID
SET n:Test
It should be something like this. The total needs to be divided into a test and train based on the 1:2 ratio.