How does apache spark knows the how to communicate between computing nodes?

I have created a JavaPairRDD from two different datasets- first one is the output file from METIS graph partitioning algorithm, and second is the input graph for the METIS graph partitioning algorithm. The graph has been partitioned into two different partition. However, after moving the vertices to two different partitions, how to connect those vertices with each other including another partition, so that I can obtain parallelization for running algorithms like Dijkstra or nearest neighbors. I will post a diagram that may help to understand the scenario.

img

How to connect the partition 0 and partition 1, that are located in 2 different partitions? I am aware that the vertices that links two partition are border vertex and the bridge edges. However, I am not able to logically map it. So I am stuck in this logic. Logical guideline or suggestions would be highly appreciated.