Given a rdd in pyspark, $A=[(0, 1), (1, 2), (1, 3), (3, 0)]$
I am trying to find self join of A such that the second element of previous pair is equal to first element of next pair i.e.
$result=[(0, 2), (0, 3), (1, 0)]$
I tried taking cartesian but it is giving other possibilities.
Also I tried with reverse of the above and then joining but it is also giving many use cases.
Please let me know the correct approach to solve the above.