How can I implement QT (quality threshold) clustering in Perl?
I am having troub开发者_如何学Cle with a QT clustering implementation that I want to implement in Perl.
The line beginning with "identify set", the third from the end, is the part I can't figure out.
The full paper is available here.
A sub i
is a cluster. {A sub 1, A sub 2, ..., A sub |G|}
is a cluster of clusters.
Identify set C in {A sub 1, A sub 2, ..., A sub |G|} with maximum cardinality
means finding the largest cluster A sub i
.
In perl, if the cluster of clusters is:
my @bigun = (
[1, 2, 3],
[4, 5, 6, 7],
[8]
);
then
# @C = @{ $bigun[1] };
use List::Util qw/reduce/;
my @C = @{ reduce { @$a > @$b ? $a : $b } @bigun };
精彩评论