Hello LanX ! and oh my god !!!
#!/usr/bin/perl
use Graph::Undirected;
use strict; use warnings;
my $g = Graph::Undirected->new;
my @key_array = 'a' .. 'z';
my @set_array = ( ['a', 'b'], ['e','f'], ['f','g'] );
$g->add_vertex( $_ ) for @key_array;
$g->add_edge( $_->[0], $_->[1] ) for @set_array;
print "$_\n" for
sort { length($b) <=> length($a) || $a cmp $b }
map {join( ',', @$_) }
$g->connected_components;
I totally forgot about Graph module until you tell me.
I would like to read your pages you gave me.
Really thanks for your reply.