          }
            var pdistance = q1.indexInParent == q2.indexInParent ? 0 : 100;
            var totalDistance = sum / q1.overlappingSegments.length + pdistance;
            if (totalDistance < maxThreshold) {
                var edge = {
                    id: id,
                    src: q1,
                    dest: q2,
                    distance: totalDistance,
                    curve: null,
                    deleted: false
                };
                edges.push(edge);
             