this algorithm can use on undirected graph. test graph: point_1 point_2 output 0 1 [0->1] 1 3 [1->2->3], [1->4->3] 0 3 [0->1->2->3], [0->1->4->3]