There is a file with three columns.Columns 1 and 2 contain numbers drawn from the same set.The file will typically have one line for each pair of members of the set;so, if there are n members,there should be n×(n−1)/2 lines.Column 3 shows the amount of connectedness between numbers in columns 1 and 2.I want to partition my source set into groups of consecutive values(i.e., ranges) for which connectedness is greater than or equal to 0.2.For example, in this small data set:input:1   2       0.2221   3       0.2131   4       0.0141   5       0.0011   6       0.5551   7       0.5092   3       0.2132   4       0.0142   5       0.0012   6       0.5552   7       0.7092   8       0.5093   4       0.9953   5       0.3233   6       0.5553   7       0.2253   8       0.0014   5       0.0954   6       0.0584   7       0.3354   8       0.0055   6       0.9955   7       0.6585   8       0.6506   7       0.4316   8       0.3337   8       0.754the output should be like:output:   G1: 1 2 3    G2: 4   G3 :5 6 7 8Connectedness between 1 with 2 and 3, is greater than 0.2, so 1, 2 and 3  should be placed in  first group. In fact, any pair of numbers within a group must have enough connectedness together. Despite high relation between 1/2/3 and 6 (0.555 > 0.2), 6 should not be placed in the first group, since previous numbers (4 and 5) had low connectedness with 1. So we must not jump over 4 and 5 and connect numbers in the first group with 6.Number 4 does not have the high connectedness with 5, so number 4 should be in the second group individually. No matter that 4 has a high connectedness with 7 since the previous numbers (5 and 6) were in low connectedness with 4 and we must not jump over numbers in between and connect 4 with 7.5 has a high connectedness with 6, 7 and 8. Also, any pair of numbers (like 6/7, 6/8, 7/8) have high connectedness together.Therefore they should be placed together in the third group.That is why all of these numbers can be placed in one group.Note that the real data does not begin from number 1 and there are over 100,000 lines. so it is huge.here is a part of my real data:input:    49997 49998 0.082    49997 49999 0.953    49997 50000 0.060    49998 49999 0.288    49998 50000 0.288    49999 50000 0.265output should be:  G1:49997   G3: 49998 49999 50000
How to group values based on a connectedness metric?
linux;shell script;perl
Loop over the input. While the first number is the same and connectedness is over the threshold, add numbers to the same group. Once the connectedness is too low, do nothing until you meet the second number in the first column.#!/usr/bin/perluse warnings;use strict;my $THRESHOLD = 0.2;my $next;my @groups;while (<>) {    my ($n1, $n2, $connectedness) = split;    @groups = ([ $next = $n1 ]) unless defined $next;    if ($next == $n1) {        if ($connectedness > $THRESHOLD) {            push @{ $groups[-1] }, $n1 unless @{ $groups[-1] };            push @{ $groups[-1] }, $n2;        } else {            $next = $n2;            push @groups, [$n2];        }    }}for my $i (1 .. @groups) {    print Group $i: @{ $groups[ $i - 1 ] }\n;}