I have a setup like the attached image. Orange nodes denotes the cases and the Blue nodes denotes the Performers
As mentionned in the question comment, your calculation should be reversed :
node j - node i >= 2
One point more, for case 3, Following your explanations there should be a third relationship between node 2 and 3
Here is a query I made, you can test it in this neo4j console : http://console.neo4j.org/r/gpfesu
MATCH (n:Case)
MATCH path=(pe)<--(n)-->(pe2)
WHERE pe.name = pe2.name
AND pe2.id - pe.id >= 2
WITH path,n, (pe2.id - pe.id) as length
WITH range(head(nodes(path)).id+1, last(nodes(path)).id-1) as ids,
n,
head(nodes(path)).id as starter,
length
UNWIND ids as x
MATCH (perf:Performer {id:starter})<--(n)-->(perf2:Performer {id:x})
MERGE (perf)-[:RELATES_TO {value:1, length:length}]->(perf2)