I am using graphframes
in pyspark for some graph type of analytics and wondering what would be the best way to create the edge list data frame from a vertices data frame.
For example, below is my vertices data frame. I have a list of ids and they belong to different groups.
+---+-----+
|id |group|
+---+-----+
|a |1 |
|b |2 |
|c |1 |
|d |2 |
|e |3 |
|a |3 |
|f |1 |
+---+-----+
My objective is to create an edge list data frame to indicate ids which appear in common groups. Please note that 1 id could appear in multiple groups (e.g. id a above is in group 1 and 3). Below is the edge list data frame that I'd like to get:
+---+-----+-----+
|src|dst |group|
+---+-----+-----+
|a |c |1 |
|a |f |1 |
|c |f |1 |
|b |d |2 |
|a |e |3 |
+---+-----+-----+
Thanks in advance!