2 Answers
2

Try creating a graph with networkx. Then use the function spring_layout to get the (x, y) coordinates of each node, and then using these data apply the clustering algorithm in order to find 2-points clusters. Tell me if this is nearly what you were looking for.