Algorithm-EquivalenceSets
view release on metacpan or search on metacpan
# @equiv_sets is ([ qw(c f 5 7) ], [ qw(a b d e 1 2 3 4 6) ])
DESCRIPTION
This module exports one function, "equivalence_sets()", which takes a
list of sets and returns another list of sets whose contents are
transitively grouped from the input sets.
Imagine the input sets to be "[ 1, 2 ]", "[ 3, 4 ]", "[ 5, 6 ]" and "[
1, 3, 7 ]". The returned sets would be "[ 1, 2, 3, 4, 7 ]" and "[ 5, 6
]", because "[ 1, 2 ]" and "[ 3, 4 ]" are tied together by "[ 1, 3, 7
]", but "[ 5, 6 ]" stands on its own. So you could say the returned sets
represent a kind of transitive union. (Real mathematicians may now flame
me about the misuse of terminology.)
Each set is an array reference. The return sets are given as an array in
list context, or as a reference to that array in scalar context.
METHODS
equivalence_sets
FIXME
lib/Algorithm/EquivalenceSets.pm view on Meta::CPAN
=head1 DESCRIPTION
This module exports one function, C<equivalence_sets()>, which takes a list of
sets and returns another list of sets whose contents are transitively grouped
from the input sets.
Imagine the input sets to be C<[ 1, 2 ]>, C<[ 3, 4 ]>, C<[ 5, 6 ]>
and C<[ 1, 3, 7 ]>. The returned sets would be C<[ 1, 2, 3, 4, 7 ]> and
C<[ 5, 6 ]>, because C<[ 1, 2 ]> and C<[ 3, 4 ]> are tied together by
C<[ 1, 3, 7 ]>, but C<[ 5, 6 ]> stands on its own. So you could say the
returned sets represent a kind of transitive union. (Real mathematicians may
now flame me about the misuse of terminology.)
Each set is an array reference. The return sets are given as an array in list
context, or as a reference to that array in scalar context.
=head1 METHODS
=head2 equivalence_sets
( run in 2.299 seconds using v1.01-cache-2.11-cpan-483215c6ad5 )