The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Algorithm::MLCS - Fast heuristic algorithm for finding Longest Common Subsequence of multiple sequences

VERSION

Version 1.02

SYNOPSIS

    use Data::Dumper;
    use Algorithm::MLCS;

    my @seqs = (
        [ qw/a b c d f g h j q z/ ],
        [ qw/a b c d f g h j q z/ ],
        [ qw/a b c x f h j q z/   ],
        [ qw/a b c f g j q z/     ],
    );

    my @lcs = lcs( \@seqs );
    my $lcs_length = lcs( \@seqs );
    print Dumper( \@lcs );

ABSTRACT

Finding the longest common subsequence (LCS) for the general case of an arbitrary number of input sequences is an NP-hard problem. Algorithm::MLCS implements a fast heuristic algorithm that addresses the general case of multiple sequences. It is able to extract common subsequence that is close to the optimal ones.

METHODS

lcs ( \@seqs )

Finds a Longest Common Subsequence of multiple sequences given by @seqs arrayref. Each element of @seqs is arrayref that represents the one of multiple sequences (e.g. [ ['a', 'b', 'c'], ['a', 'c', 'd', 'e'], ... ]). In list context it returns LCS array, in scalar - the length of LCS.

SEE ALSO

Algorithm::LCS

AUTHOR

Slava Moiseev, <slava.moiseev at yahoo.com>

LICENSE AND COPYRIGHT

Copyright 2012 Slava Moiseev.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.