Find connected components in list of triangle vertices
问题 Consider two graphs, G1 = (V1, E1), G2 = (V2, E2) V1 = {1,2,3,4,5,6} V2 = {7,8,9,10,11,12} In space, these vertices are connected by triangles faces (each with three vertices) F1 = [[ 2, 1, 0], [ 0, 3, 2], [ 1, 4, 0], [ 0, 4, 3], [ 5, 1, 2], [ 3, 5, 2], [ 5, 4, 1], [ 4, 5, 3]] F2 = [[ 8, 7, 6], [ 6, 9, 8], [ 7, 10, 6], [ 6, 10, 9], [11, 7, 8], [ 9, 11, 8], [11, 10, 7], [10, 11, 9]] The above is what I am trying to find. If we are given the entire array of faces: faces = [[ 2, 1, 0], [ 0, 3, 2