suffix trees algorithm
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 1795
Suffix tree implementation library 1.2
Suffix tree implementation library is a C library, an implementation of the suffix trees algorithm to store/retrieve key/data pa more>>
Suffix tree implementation library is a C library, an implementation of the suffix trees algorithm to store/retrieve key/data pairs.
The main advantages are a linear indexing time, little memory usage, and very fast retrieving.
It has been developped on FreeBSD/gcc but should be fairly portable.
The source code "testsfx.c" show an example of how to use the library both for inserting, retrieving, and deleting data. There arent many functions and comments should be enough to give you an idea of how to use the library. (read the header of the source file)
You should edit sfxdisk.h to suit your needs: you can change the alphabet size and the offset type. It should be OK to use "long long" 64 bits ints instead of long, in fact I tested it succesfully but havent gone to the point of filling more than 2 GB of data (needless to say you need a 64 bits filesystem).
Two "tools" come with the library (new with version 1.2): dumpsfx and loadsfx. dumpsfx is used to dump the database: dumpsfx [-s separator] if you want to output the result as readable text or dumpsfx < file.sfx > -h to output it for reloading with loadsfx.
dumpsfx outputs on stdout and loadsfx reads from stdin. loadsfx < suffix tree file to create > < dumped_file
Enhancements:
- removed an useless offset incrementation in STwritenode
<<lessThe main advantages are a linear indexing time, little memory usage, and very fast retrieving.
It has been developped on FreeBSD/gcc but should be fairly portable.
The source code "testsfx.c" show an example of how to use the library both for inserting, retrieving, and deleting data. There arent many functions and comments should be enough to give you an idea of how to use the library. (read the header of the source file)
You should edit sfxdisk.h to suit your needs: you can change the alphabet size and the offset type. It should be OK to use "long long" 64 bits ints instead of long, in fact I tested it succesfully but havent gone to the point of filling more than 2 GB of data (needless to say you need a 64 bits filesystem).
Two "tools" come with the library (new with version 1.2): dumpsfx and loadsfx. dumpsfx is used to dump the database: dumpsfx [-s separator] if you want to output the result as readable text or dumpsfx < file.sfx > -h to output it for reloading with loadsfx.
dumpsfx outputs on stdout and loadsfx reads from stdin. loadsfx < suffix tree file to create > < dumped_file
Enhancements:
- removed an useless offset incrementation in STwritenode
Download (0.015MB)
Added: 2006-08-07 License: GPL (GNU General Public License) Price:
1189 downloads
IDS::Algorithm::MM 1.02
IDS::Algorithm::MM is a Perl module created to learn or test using a first-order Markov Model (MM). more>>
IDS::Algorithm::MM is a Perl module created to learn or test using a first-order Markov Model (MM).
SYNOPSIS
A usage synopsis would go here. Since it is not here, read on.
In section 4.2 in Kruegel and Vignas paper, they ignored the probability information that the MM provided, and produced a binary result. In effect, they were using the constructed MM as a {N,D}FA.
Someday more will be here.
Ideally, we would be using the algorithm from stolcke94bestfirst. Constructing a DFA rather than a NFA in effect has performed most of the state merging that stolcke93hidden do.
Consider also a java or C/C++ implementaion: http://www.ghmm.org/ http://www.run.montefiore.ulg.ac.be/~francois/software/jahmm/
Useful information: http://www.cs.brown.edu/research/ai/dynamics/tutorial/Documents/HiddenMarkovModels.html http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/main.html L R Rabiner and B H Juang, `An introduction to HMMs, IEEE ASSP Magazine, 3, 4-16.
printvcg
printvcg(filehandle)
Print in a form usable by VCG for printing the DFA.
If the filehandle is specified, print there; otherwise, print to STDOUT.
This code was stolen from DFA, and does not know about the probabilities.
load(filehandle)
Load a MM from a file; this is the inverse of "print", and the format we expect is that used in $self->print.
test(tokensref, string, instance)
Test the string of tokens and calculate the probability of the string being seen. At each stage, we get a p in [0,1]. The result is the product of these probabilities.
Note that if a transition cannot be made, we return a 0 probability.
add(tokensref, string, instance)
The collection of tokens (in the list referenced by tokensref) is a complete example of a list that should be accepted by the DFA.
string and instance are IDS::Test framework arguments that we ignore because we do not need them.
WE add the transition from the last token to the (ACCEPT) state.
add_transition(from, token)
Add a transition from one state to another when the specified token is received. It is not an error to try to add an existing transition. In that event, this function quietly returns. If no such transition exists, we look for a transition on the token; if so, we add an edge to the destination node for the existing edge. Finally, if there is no other choice, we create a new state and add the edge.
generalize()
Reduce the number of states in the model.
Our building a DFA rather than a NFA has in effect performed most of the state merging that would have occurred.
XXX We should still be doing some checks for additional merge possibilities.
XXX A proof that the DFA is effectively the NFA with merged states would be useful.
<<lessSYNOPSIS
A usage synopsis would go here. Since it is not here, read on.
In section 4.2 in Kruegel and Vignas paper, they ignored the probability information that the MM provided, and produced a binary result. In effect, they were using the constructed MM as a {N,D}FA.
Someday more will be here.
Ideally, we would be using the algorithm from stolcke94bestfirst. Constructing a DFA rather than a NFA in effect has performed most of the state merging that stolcke93hidden do.
Consider also a java or C/C++ implementaion: http://www.ghmm.org/ http://www.run.montefiore.ulg.ac.be/~francois/software/jahmm/
Useful information: http://www.cs.brown.edu/research/ai/dynamics/tutorial/Documents/HiddenMarkovModels.html http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/main.html L R Rabiner and B H Juang, `An introduction to HMMs, IEEE ASSP Magazine, 3, 4-16.
printvcg
printvcg(filehandle)
Print in a form usable by VCG for printing the DFA.
If the filehandle is specified, print there; otherwise, print to STDOUT.
This code was stolen from DFA, and does not know about the probabilities.
load(filehandle)
Load a MM from a file; this is the inverse of "print", and the format we expect is that used in $self->print.
test(tokensref, string, instance)
Test the string of tokens and calculate the probability of the string being seen. At each stage, we get a p in [0,1]. The result is the product of these probabilities.
Note that if a transition cannot be made, we return a 0 probability.
add(tokensref, string, instance)
The collection of tokens (in the list referenced by tokensref) is a complete example of a list that should be accepted by the DFA.
string and instance are IDS::Test framework arguments that we ignore because we do not need them.
WE add the transition from the last token to the (ACCEPT) state.
add_transition(from, token)
Add a transition from one state to another when the specified token is received. It is not an error to try to add an existing transition. In that event, this function quietly returns. If no such transition exists, we look for a transition on the token; if so, we add an edge to the destination node for the existing edge. Finally, if there is no other choice, we create a new state and add the edge.
generalize()
Reduce the number of states in the model.
Our building a DFA rather than a NFA has in effect performed most of the state merging that would have occurred.
XXX We should still be doing some checks for additional merge possibilities.
XXX A proof that the DFA is effectively the NFA with merged states would be useful.
Download (0.032MB)
Added: 2007-06-18 License: Perl Artistic License Price:
858 downloads
Fast Genetic Algorithm 1.3.4
Fast Genetic Algorithm is a simple yet powerful implementation of a general genetic algorithm. more>>
Fast Genetic Algorithm is a simple yet powerful implementation of a general genetic algorithm, and provides many types of crossover and selection procedures.
It is suitable to solve mathematical problems such as combinatorical optimization ones, as well as to build artificial life simulations.
Written in C++, the library is released under the terms of the GNU Lesser General Public License, and its easy to incorporate in other applications.
Further improvements include parallelization of the algorithm in multi-processor environments and general performance optimizations.
You can download the current development snapshot, which is a working but not fully tested version of the library.
Enhancements:
- Dynamic arrays were fixed to compile even on non-C99 compilers (like MSVC).
- A switch to choose whether to preserve the fittest individual across generations was added.
- The pthreads-win32 library was included in the package, as well as Visual C++ and Dev-C++ projects to easily build the source code on Windows.
- A function that computes the standard deviation of fitness values was added (thanks to Jonas Neubert for the contribution).
<<lessIt is suitable to solve mathematical problems such as combinatorical optimization ones, as well as to build artificial life simulations.
Written in C++, the library is released under the terms of the GNU Lesser General Public License, and its easy to incorporate in other applications.
Further improvements include parallelization of the algorithm in multi-processor environments and general performance optimizations.
You can download the current development snapshot, which is a working but not fully tested version of the library.
Enhancements:
- Dynamic arrays were fixed to compile even on non-C99 compilers (like MSVC).
- A switch to choose whether to preserve the fittest individual across generations was added.
- The pthreads-win32 library was included in the package, as well as Visual C++ and Dev-C++ projects to easily build the source code on Windows.
- A function that computes the standard deviation of fitness values was added (thanks to Jonas Neubert for the contribution).
Download (0.22MB)
Added: 2007-07-16 License: LGPL (GNU Lesser General Public License) Price:
835 downloads
Robsort Sorting Algorithm 1.0
Robsort Sorting Algorithm is a sorting algorithm which uses random numbers. more>>
Robsort in a GNU public license sorting algorithm devleloped by Robert Thompson. Robsort uses random number generation to sort arrays of integers. It is claimed to be the worlds least efficient sorting algorithm.
Scientists have calculated the robsort algorithm to approach an order of [n!] (n factorial) inefficiency, however this inefficiency could only theoretically be obtained by using truly random numbers.
<<lessScientists have calculated the robsort algorithm to approach an order of [n!] (n factorial) inefficiency, however this inefficiency could only theoretically be obtained by using truly random numbers.
Download (0.10MB)
Added: 2005-06-06 License: GPL (GNU General Public License) Price:
1601 downloads
Algorithm::C3 0.05
Algorithm::C3 is a module for merging hierarchies using the C3 algorithm. more>>
Algorithm::C3 is a module for merging hierarchies using the C3 algorithm.
SYNOPSIS
use Algorithm::C3;
# merging a classic diamond
# inheritence graph like this:
#
#
# /
#
# /
#
my @merged = Algorithm::C3::merge(
D,
sub {
# extract the ISA array
# from the package
no strict refs;
@{$_[0] . ::ISA};
}
);
print join ", " => @merged; # prints D, B, C, A
This module implements the C3 algorithm. I have broken this out into its own module because I found myself copying and pasting it way too often for various needs. Most of the uses I have for C3 revolve around class building and metamodels, but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precendence orderings.
<<lessSYNOPSIS
use Algorithm::C3;
# merging a classic diamond
# inheritence graph like this:
#
#
# /
#
# /
#
my @merged = Algorithm::C3::merge(
D,
sub {
# extract the ISA array
# from the package
no strict refs;
@{$_[0] . ::ISA};
}
);
print join ", " => @merged; # prints D, B, C, A
This module implements the C3 algorithm. I have broken this out into its own module because I found myself copying and pasting it way too often for various needs. Most of the uses I have for C3 revolve around class building and metamodels, but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precendence orderings.
Download (0.008MB)
Added: 2006-10-20 License: Perl Artistic License Price:
1099 downloads
STX B+ Tree 0.8
STX B+ Tree project is a set of C++ template classes implementing a B+ tree key/data container in main memory. more>>
STX B+ Tree project is a set of C++ template classes implementing a B+ tree key/data container in main memory. The classes are designed as drop-in replacements of the STL containers set, map, multiset and multimap and follow their interfaces very closely. By packing multiple value pairs into each node of the tree the B+ tree reduces heap fragmentation and utilizes cache-line effects better than the standard red-black binary tree.
The tree algorithms are based on the implementation in Cormen, Leiserson and Rivests Introduction into Algorithms, Jan Janninks paper and other algorithm resources. The classes contain extensive assertion and verification mechanisms to ensure the implementations correctness by testing the tree invariants.
The main B+ tree implementation can be found in doxygen stx/btree.h or with plain text comments btree.h.
Special interest was put into performing a speed comparison test between the standard red-black tree and the new B+ tree implementation. The speed test results are interesting and show the B+ tree to be significantly faster.
Enhancements:
- This release introduces the demonstration program wxBTreeDemo.
- This program draws illustrations of the B+ trees constructed by the STX B+ Tree template classes.
- It allows the user to select different types of B+ tree instantiations: integer or string keys and different slot numbers.
- The user may insert and erase key/data pairs from the tree and run different search operations.
- The demo program uses the cross-platform wxWidgets toolkit and can be compiled on Linux, Windows, and Mac OS X.
<<lessThe tree algorithms are based on the implementation in Cormen, Leiserson and Rivests Introduction into Algorithms, Jan Janninks paper and other algorithm resources. The classes contain extensive assertion and verification mechanisms to ensure the implementations correctness by testing the tree invariants.
The main B+ tree implementation can be found in doxygen stx/btree.h or with plain text comments btree.h.
Special interest was put into performing a speed comparison test between the standard red-black tree and the new B+ tree implementation. The speed test results are interesting and show the B+ tree to be significantly faster.
Enhancements:
- This release introduces the demonstration program wxBTreeDemo.
- This program draws illustrations of the B+ trees constructed by the STX B+ Tree template classes.
- It allows the user to select different types of B+ tree instantiations: integer or string keys and different slot numbers.
- The user may insert and erase key/data pairs from the tree and run different search operations.
- The demo program uses the cross-platform wxWidgets toolkit and can be compiled on Linux, Windows, and Mac OS X.
Download (0.36MB)
Added: 2007-05-15 License: LGPL (GNU Lesser General Public License) Price:
548 downloads
Algorithm::LUHN 1.00
Algorithm::LUHN is a Perl module to calculate the modulus 10 double add double checksum. more>>
Algorithm::LUHN is a Perl module to calculate the modulus 10 double add double checksum.
SYNOPSIS
use Algorithm::LUHN qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It worksn" if is_valid("43881234567$c");
$c = check_digit("A2C4E6G8"); # this will cause an error
print "Valid LUHN characters are:n";
my %vc = Algorithm::LUHN::valid_chars();
for (sort keys %vc) {
print "$_ => $vc{$_}n";
}
Algorithm::LUHN::valid_chars(map {$_ => ord($_)-ord(A)+10} A..Z);
$c = check_digit("A2C4E6G8");
print "It worked againn" if is_valid("A2C4E6G8$c");
This module calculates the Modulus 10 Double Add Double checksum, also known as the LUHN Formula. This algorithm is used to verify credit card numbers and Standard & Poors security identifiers such as CUSIPs and CSINs.
You can find plenty of information about the algorithm by searching the web for "modulus 10 double add double".
<<lessSYNOPSIS
use Algorithm::LUHN qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It worksn" if is_valid("43881234567$c");
$c = check_digit("A2C4E6G8"); # this will cause an error
print "Valid LUHN characters are:n";
my %vc = Algorithm::LUHN::valid_chars();
for (sort keys %vc) {
print "$_ => $vc{$_}n";
}
Algorithm::LUHN::valid_chars(map {$_ => ord($_)-ord(A)+10} A..Z);
$c = check_digit("A2C4E6G8");
print "It worked againn" if is_valid("A2C4E6G8$c");
This module calculates the Modulus 10 Double Add Double checksum, also known as the LUHN Formula. This algorithm is used to verify credit card numbers and Standard & Poors security identifiers such as CUSIPs and CSINs.
You can find plenty of information about the algorithm by searching the web for "modulus 10 double add double".
Download (0.004MB)
Added: 2007-05-16 License: Perl Artistic License Price:
893 downloads
mcl-algorithm 06-021
mcl-algorithm is a scalable cluster algorithm for graphs based on stochastic flow. more>>
mcl-algorithm is a scalable cluster algorithm for graphs based on stochastic flow.
The flow process employed by the algorithm is mathematically sound and intrinsically tied to cluster structure in graphs, which is revealed as the imprint left by the process.
The threaded implementation has handled graphs of up to one million nodes within hours, and is widely used in the field of protein family analysis. It comes with a wide range of sibling utilities for handling and analyzing graphs, matrices, and clusterings.
The MCL algorithm simulates flow using (alternating) two simple algebraic operations on matrices. Its formulation is simple and elegant. There are no high-level procedural instructions for assembling, joining, or splitting of groups - cluster structure is bootstrapped via a flow process that is inherently affected by any cluster structure present.
The first operation used by MCL is expansion, which coincides with normal matrix multiplication. Expansion models the spreading out of flow, it becoming more homogeneous. The second is inflation, which is mathematically speaking a Hadamard power followed by a diagonal scaling. Inflation models the contraction of flow, it becoming thicker in regions of higher current and thinner in regions of lower current. The MCL process causes flow to spread out within natural clusters and evaporate inbetween different clusters.
- By varying parameters, clusterings on different scales of granularity can be found. The number of clusters can not and need not be specified in advance, but the algorithm can be adapted to different contexts.
- The issue how many clusters? is not dealt with in an arbitrary manner, but rather by strong internal logic. Cluster structure leaves its marks on the flow process simulated by the algorithm, and the flow parameters control the granularity of the cluster imprint.
- The limit of the MCL process (the process simulated by the algorithm) is in general extremely sparse, and the iterands are sparse in a weighted sense. This gives the means to scale the algorithm drastically, leading to a worst-case complexity of order Nk^2, where N is the number of nodes of the input graph, and where k is a threshold for the number of resources allocated per node.
- The rate of convergence of the MCL process, and projection of the iterands afterwards onto the resulting clustering, give hooks for unsupervised parameter adjustment.
- The iterands of the MCL process have structural properties which allow a cluster interpretation, and which generalize the mapping of MCL limits onto clusterings. The mathematics associated with the MCL process shows that there is an intrinsic relationship between the MCL process and cluster structure in graphs. This is very valuable given the many heuristic approaches in cluster analysis.
Enhancements:
- Numerous cleanups in much of the code.
- Improvements in caching intermediate results.
<<lessThe flow process employed by the algorithm is mathematically sound and intrinsically tied to cluster structure in graphs, which is revealed as the imprint left by the process.
The threaded implementation has handled graphs of up to one million nodes within hours, and is widely used in the field of protein family analysis. It comes with a wide range of sibling utilities for handling and analyzing graphs, matrices, and clusterings.
The MCL algorithm simulates flow using (alternating) two simple algebraic operations on matrices. Its formulation is simple and elegant. There are no high-level procedural instructions for assembling, joining, or splitting of groups - cluster structure is bootstrapped via a flow process that is inherently affected by any cluster structure present.
The first operation used by MCL is expansion, which coincides with normal matrix multiplication. Expansion models the spreading out of flow, it becoming more homogeneous. The second is inflation, which is mathematically speaking a Hadamard power followed by a diagonal scaling. Inflation models the contraction of flow, it becoming thicker in regions of higher current and thinner in regions of lower current. The MCL process causes flow to spread out within natural clusters and evaporate inbetween different clusters.
- By varying parameters, clusterings on different scales of granularity can be found. The number of clusters can not and need not be specified in advance, but the algorithm can be adapted to different contexts.
- The issue how many clusters? is not dealt with in an arbitrary manner, but rather by strong internal logic. Cluster structure leaves its marks on the flow process simulated by the algorithm, and the flow parameters control the granularity of the cluster imprint.
- The limit of the MCL process (the process simulated by the algorithm) is in general extremely sparse, and the iterands are sparse in a weighted sense. This gives the means to scale the algorithm drastically, leading to a worst-case complexity of order Nk^2, where N is the number of nodes of the input graph, and where k is a threshold for the number of resources allocated per node.
- The rate of convergence of the MCL process, and projection of the iterands afterwards onto the resulting clustering, give hooks for unsupervised parameter adjustment.
- The iterands of the MCL process have structural properties which allow a cluster interpretation, and which generalize the mapping of MCL limits onto clusterings. The mathematics associated with the MCL process shows that there is an intrinsic relationship between the MCL process and cluster structure in graphs. This is very valuable given the many heuristic approaches in cluster analysis.
Enhancements:
- Numerous cleanups in much of the code.
- Improvements in caching intermediate results.
Download (1.1MB)
Added: 2006-01-24 License: GPL (GNU General Public License) Price:
1370 downloads
Parallel Genetic Algorithm Library 0.99
Parallel Genetic Algorithm Library is a C++ toolkit for producing genetic algorithm code. more>>
Parallel Genetic Algorithm Library (or PGAL for short) is a C++ toolkit for simply, efficiently, and swiftly producing genetic algorithm code that works across multiple processors.
This is useful not only for those with multi-processor computers, but also for distributed and cluster computing genetic algorithm environments such as openMosix.
<<lessThis is useful not only for those with multi-processor computers, but also for distributed and cluster computing genetic algorithm environments such as openMosix.
Download (0.074MB)
Added: 2007-06-29 License: GPL (GNU General Public License) Price:
852 downloads
Genetic Algorithm File Fitter 0.5.1
Genetic Algorithm File Fitter extracts subsets of an input list of files/directories. more>>
Genetic Algorithm File Fitter (gaffitter) is a command-line software written in C++ that extracts --via Genetic Algorithm-- subsets of an input list of files/directories that best fit the given volume size (target), such as CD, DVD and others. Genetic Algorithm File Fitter is initially designed to run under Linux and POSIX systems, but easily portable to non-POSIX operating environment.
Using GA search, gaffitter improve different combinations of the files on the list so that the lost of space will be minimized. Ideal to be used for backups/records in CD, DVD and others.
Main features:
- Uses a global meta-heuristic (Genetic Algorithm search).
- The command-line interface provides high integration (via pipe) with other tools, i.e. works as a "filter".
- Pretty configurable. gaffitter have many input parameters to control/adjust its behavior (including GA params).
- It is free software! (GPL)
Usage:
gaffitter [options...] < files >
... | gaffitter - [options...] [files]
General options:
-t < n >, --target < n >
target size [default = 700]
--bytes
target, min and max size in bytes
--kb
target, min and max size in kibi bytes (KiB)
--mb
target, min and max size in mebi bytes (MiB) [default]
--gb
target, min and max size in gibi bytes (GiB)
-i < n >, --iter < n >
number of iterations [default = 1]
-v, --verbose
verbose
--min < n >, --min-size < n >
minimum file size [default = none]
--max < n >, --max-size < n >
maximum file size [default = none]
--bs < n >, --block-size < n >
the smallest amount of bytes a file can occupy [default = 1]
--ss, --show-size
print size of each output file
--sb, --show-bytes
print output sizes in bytes too
--su, --show-unselected
print unselected files
--hsel, --hide-selected
Dont print selected files
--hs, --hide-summary
hide summary line containing sum, difference and number of
selected files
-h, --help
this help
Enhancements:
- This release fixes a bug regarding an uninitialized variable and changes the default behavior of GAFFitter, which now extracts the volumes as much as possible (with unlimited iterations).
<<lessUsing GA search, gaffitter improve different combinations of the files on the list so that the lost of space will be minimized. Ideal to be used for backups/records in CD, DVD and others.
Main features:
- Uses a global meta-heuristic (Genetic Algorithm search).
- The command-line interface provides high integration (via pipe) with other tools, i.e. works as a "filter".
- Pretty configurable. gaffitter have many input parameters to control/adjust its behavior (including GA params).
- It is free software! (GPL)
Usage:
gaffitter [options...] < files >
... | gaffitter - [options...] [files]
General options:
-t < n >, --target < n >
target size [default = 700]
--bytes
target, min and max size in bytes
--kb
target, min and max size in kibi bytes (KiB)
--mb
target, min and max size in mebi bytes (MiB) [default]
--gb
target, min and max size in gibi bytes (GiB)
-i < n >, --iter < n >
number of iterations [default = 1]
-v, --verbose
verbose
--min < n >, --min-size < n >
minimum file size [default = none]
--max < n >, --max-size < n >
maximum file size [default = none]
--bs < n >, --block-size < n >
the smallest amount of bytes a file can occupy [default = 1]
--ss, --show-size
print size of each output file
--sb, --show-bytes
print output sizes in bytes too
--su, --show-unselected
print unselected files
--hsel, --hide-selected
Dont print selected files
--hs, --hide-summary
hide summary line containing sum, difference and number of
selected files
-h, --help
this help
Enhancements:
- This release fixes a bug regarding an uninitialized variable and changes the default behavior of GAFFitter, which now extracts the volumes as much as possible (with unlimited iterations).
Download (0.037MB)
Added: 2007-03-28 License: GPL (GNU General Public License) Price:
942 downloads
Algorithm::Merge 0.08
Algorithm::Merge is a Perl module package that provides three-way merge and diff. more>>
Algorithm::Merge is a Perl module package that provides three-way merge and diff.
SYNOPSIS
use Algorithm::Merge qw(merge diff3 traverse_sequences3);
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
@diff = diff3(@ancestor, @a, @b);
@diff = diff3(@ancestor, @a, @b, $key_generation_function);
$diff = diff3(@ancestor, @a, @b);
$diff = diff3(@ancestor, @a, @b, $key_generation_function);
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
USAGE
This module complements Algorithm::Diff by providing three-way merge and diff functions.
In this documentation, the first list to diff3, merge, and traverse_sequences3 is called the `original list. The second list is the `left list. The third list is the `right list.
The optional key generation arguments are the same as in Algorithm::Diff. See Algorithm::Diff for more information.
<<lessSYNOPSIS
use Algorithm::Merge qw(merge diff3 traverse_sequences3);
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
@diff = diff3(@ancestor, @a, @b);
@diff = diff3(@ancestor, @a, @b, $key_generation_function);
$diff = diff3(@ancestor, @a, @b);
$diff = diff3(@ancestor, @a, @b, $key_generation_function);
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
USAGE
This module complements Algorithm::Diff by providing three-way merge and diff functions.
In this documentation, the first list to diff3, merge, and traverse_sequences3 is called the `original list. The second list is the `left list. The third list is the `right list.
The optional key generation arguments are the same as in Algorithm::Diff. See Algorithm::Diff for more information.
Download (0.010MB)
Added: 2007-05-16 License: Perl Artistic License Price:
892 downloads
C Algorithms Library 1.0.0
C Algorithms Library is a collection of commonly used Computer Science algorithms. more>>
C Algorithms Library is a collection of commonly used Computer Science algorithms.
The focus is on code that is well documented and tested, portable, and reusable.
The C Programming Language has a much smaller standard library compared to other more modern programming languages such as Java or Python.
In particular, it lacks implementations of many common data structures and algorithms. This is a collection of such algorithms to attempt to alleviate this problem.
The source code is released under the Modified BSD license, and as such can be freely modified and reused in any project, either proprietary or free. It is written in 100% ANSI standard C.
Each algorithm is written to be independent from the other implementations, allowing particular algorithms to be included in projects as needed.
Data structures
Collections
ArrayList : Automatically resizing array.
Doubly linked list : A set of values stored in a list with links that point in both directions.
Singly linked list : A set of values stored in a list with links that point in one direction.
Queue : Double ended queue which can be used as a FIFO or a stack.
Set : Unordered set of values.
Mappings
Hash table : Collection of values which can be addressed using a key.
Trie : Fast mapping using strings as keys.
Binary search trees
AVL tree : Balanced binary search tree with O(log n) worst case performance.
Utility functions
All of the above data structures operate on void pointers. It is sometimes necessary to compare values (when sorting a list, for example) or generate a hash key (in a hash table or set). This is done by providing a pointer to a function which provides this functionality. The following functions provide this functionality for some common data types.
- Integer comparison and hash functions.
- String comparison and hash functions.
- Generic (void) pointer comparison and hash functions.
<<lessThe focus is on code that is well documented and tested, portable, and reusable.
The C Programming Language has a much smaller standard library compared to other more modern programming languages such as Java or Python.
In particular, it lacks implementations of many common data structures and algorithms. This is a collection of such algorithms to attempt to alleviate this problem.
The source code is released under the Modified BSD license, and as such can be freely modified and reused in any project, either proprietary or free. It is written in 100% ANSI standard C.
Each algorithm is written to be independent from the other implementations, allowing particular algorithms to be included in projects as needed.
Data structures
Collections
ArrayList : Automatically resizing array.
Doubly linked list : A set of values stored in a list with links that point in both directions.
Singly linked list : A set of values stored in a list with links that point in one direction.
Queue : Double ended queue which can be used as a FIFO or a stack.
Set : Unordered set of values.
Mappings
Hash table : Collection of values which can be addressed using a key.
Trie : Fast mapping using strings as keys.
Binary search trees
AVL tree : Balanced binary search tree with O(log n) worst case performance.
Utility functions
All of the above data structures operate on void pointers. It is sometimes necessary to compare values (when sorting a list, for example) or generate a hash key (in a hash table or set). This is done by providing a pointer to a function which provides this functionality. The following functions provide this functionality for some common data types.
- Integer comparison and hash functions.
- String comparison and hash functions.
- Generic (void) pointer comparison and hash functions.
Download (0.33MB)
Added: 2006-01-31 License: BSD License Price:
1376 downloads
Algorithm::Loops 1.031
Algorithm::Loops is a Perl module with looping constructs: NestedLoops, MapCar*, Filter, and NextPermute*. more>>
Algorithm::Loops is a Perl module with looping constructs: NestedLoops, MapCar*, Filter, and NextPermute*.
SYNOPSYS
use Algorithm::Loops qw(
Filter
MapCar MapCarU MapCarE MapCarMin
NextPermute NextPermuteNum
NestedLoops
);
my @copy= Filter {tr/A-Z.,"()/a-z/d} @list;
my $string= Filter {s/s*$/ /} @lines;
my @transposed= MapCarU {[@_]} @matrix;
my @list= sort getList();
do {
usePermutation( @list );
} while( NextPermute( @list ) );
my $len= @ARGV ? $ARGV[0] : 3;
my @list= NestedLoops(
[ ( [ 1..$len ] ) x $len ],
sub { "@_" },
);
If you want working sample code to try, see below in the section specific to the function(s) you want to try. The above samples only give a feel for how the functions are typically used.
<<lessSYNOPSYS
use Algorithm::Loops qw(
Filter
MapCar MapCarU MapCarE MapCarMin
NextPermute NextPermuteNum
NestedLoops
);
my @copy= Filter {tr/A-Z.,"()/a-z/d} @list;
my $string= Filter {s/s*$/ /} @lines;
my @transposed= MapCarU {[@_]} @matrix;
my @list= sort getList();
do {
usePermutation( @list );
} while( NextPermute( @list ) );
my $len= @ARGV ? $ARGV[0] : 3;
my @list= NestedLoops(
[ ( [ 1..$len ] ) x $len ],
sub { "@_" },
);
If you want working sample code to try, see below in the section specific to the function(s) you want to try. The above samples only give a feel for how the functions are typically used.
Download (0.022MB)
Added: 2006-10-12 License: Perl Artistic License Price:
1107 downloads
Algorithm::Diff 1.1902
Algorithm::Diff is a Perl module to compute `intelligent differences between two files / lists. more>>
Algorithm::Diff is a Perl module to compute `intelligent differences between two files / lists.
SYNOPSIS
require Algorithm::Diff;
# This example produces traditional diff output:
my $diff = Algorithm::Diff->new( @seq1, @seq2 );
$diff->Base( 1 ); # Return line numbers, not indices
while( $diff->Next() ) {
next if $diff->Same();
my $sep = ;
if( ! $diff->Items(2) ) {
printf "%d,%dd%dn",
$diff->Get(qw( Min1 Max1 Max2 ));
} elsif( ! $diff->Items(1) ) {
printf "%da%d,%dn",
$diff->Get(qw( Max1 Min2 Max2 ));
} else {
$sep = "---n";
printf "%d,%dc%d,%dn",
$diff->Get(qw( Min1 Max1 Min2 Max2 ));
}
print "< $_" for $diff->Items(1);
print $sep;
print "> $_" for $diff->Items(2);
}
# Alternate interfaces:
use Algorithm::Diff qw(
LCS LCS_length LCSidx
diff sdiff compact_diff
traverse_sequences traverse_balanced );
@lcs = LCS( @seq1, @seq2 );
$lcsref = LCS( @seq1, @seq2 );
$count = LCS_length( @seq1, @seq2 );
( $seq1idxref, $seq2idxref ) = LCSidx( @seq1, @seq2 );
# Complicated interfaces:
@diffs = diff( @seq1, @seq2 );
@sdiffs = sdiff( @seq1, @seq2 );
@cdiffs = compact_diff( @seq1, @seq2 );
traverse_sequences(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
},
&key_generator,
@extra_args,
);
traverse_balanced(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
CHANGE => &callback4,
},
&key_generator,
@extra_args,
);
<<lessSYNOPSIS
require Algorithm::Diff;
# This example produces traditional diff output:
my $diff = Algorithm::Diff->new( @seq1, @seq2 );
$diff->Base( 1 ); # Return line numbers, not indices
while( $diff->Next() ) {
next if $diff->Same();
my $sep = ;
if( ! $diff->Items(2) ) {
printf "%d,%dd%dn",
$diff->Get(qw( Min1 Max1 Max2 ));
} elsif( ! $diff->Items(1) ) {
printf "%da%d,%dn",
$diff->Get(qw( Max1 Min2 Max2 ));
} else {
$sep = "---n";
printf "%d,%dc%d,%dn",
$diff->Get(qw( Min1 Max1 Min2 Max2 ));
}
print "< $_" for $diff->Items(1);
print $sep;
print "> $_" for $diff->Items(2);
}
# Alternate interfaces:
use Algorithm::Diff qw(
LCS LCS_length LCSidx
diff sdiff compact_diff
traverse_sequences traverse_balanced );
@lcs = LCS( @seq1, @seq2 );
$lcsref = LCS( @seq1, @seq2 );
$count = LCS_length( @seq1, @seq2 );
( $seq1idxref, $seq2idxref ) = LCSidx( @seq1, @seq2 );
# Complicated interfaces:
@diffs = diff( @seq1, @seq2 );
@sdiffs = sdiff( @seq1, @seq2 );
@cdiffs = compact_diff( @seq1, @seq2 );
traverse_sequences(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
},
&key_generator,
@extra_args,
);
traverse_balanced(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
CHANGE => &callback4,
},
&key_generator,
@extra_args,
);
Download (0.033MB)
Added: 2007-06-28 License: Perl Artistic License Price:
848 downloads
Algorithm::BinPack 0.5
Algorithm::BinPack is a Perl module that can efficiently pack items into bins. more>>
Algorithm::BinPack is a Perl module that can efficiently pack items into bins.
SYNOPSIS
Algorithm::BinPack efficiently packs items into bins. The bins are given a maximum size, and items are packed in with as little empty space as possible. An example use would be backing up files to CD, while minimizing the number of discs required.
my $bp = Algorithm::BinPack->new(binsize => 4);
$bp->add_item(label => "one", size => 1);
$bp->add_item(label => "two", size => 2);
$bp->add_item(label => "three", size => 3);
$bp->add_item(label => "four", size => 4);
for ($bp->pack_bins) {
print "Bin size: ", $_->{size}, "n";
print " Item: ", $_->{label}, "n" for @{ $_->{items} };
}
METHODS
new
Creates a new Algorithm::BinPack object. The maximum bin size is specified as a named argument binsize, and is required. A fudge factor may be specified as a named argument fudge. If a fudge factor is specified, item sizes will be rounded up to a number divisible by the fudge factor. This can help keep items with similar sizes in order by their labels.
my $bp = Algorithm::BinPack->new(binsize => 4);
my $bp = Algorithm::BinPack->new(binsize => 100, fudge => 10);
add_item
Adds an item to be packed into a bin. Required named arguments are label and size, but any others can be specified, and will be saved. An optional bin argument can be used to manually put an item into the specified bin.
$bp->add_item(label => one, size => 1);
$bp->add_item(label => two, size => 2, desc => The second numeral);
$bp->add_item(label => zero, size => 3, bin => 0);
$bp->add_item(qw(label three size 3));
$bp->add_item(qw(label four size 4 random key));
prefill_bin
(Deprecated method) add_item now knows how to handle the bin argument directly, so this method is redundant.
pack_bins
Packs the items into bins. This method tries to leave as little empty space in each bin as possible. It returns a list of hashrefs with the key size containing the total bin size, and items containing an arrayref holding the items in the bin. Each item is in turn a hashref containing the keys label, size, and any others added to the item. If a fudge factor was used, each item will contain a key fudgesize, which is the size this item was fudged to.
for my $bin ($bp->pack_bins) {
print "Bin size: ", $bin->{size}, "n";
for my $item (@{ $bin->{items} }) {
printf " %-6s %-20sn", $_, $item->{$_} for keys %{ $item };
print " ---n";
}
}
<<lessSYNOPSIS
Algorithm::BinPack efficiently packs items into bins. The bins are given a maximum size, and items are packed in with as little empty space as possible. An example use would be backing up files to CD, while minimizing the number of discs required.
my $bp = Algorithm::BinPack->new(binsize => 4);
$bp->add_item(label => "one", size => 1);
$bp->add_item(label => "two", size => 2);
$bp->add_item(label => "three", size => 3);
$bp->add_item(label => "four", size => 4);
for ($bp->pack_bins) {
print "Bin size: ", $_->{size}, "n";
print " Item: ", $_->{label}, "n" for @{ $_->{items} };
}
METHODS
new
Creates a new Algorithm::BinPack object. The maximum bin size is specified as a named argument binsize, and is required. A fudge factor may be specified as a named argument fudge. If a fudge factor is specified, item sizes will be rounded up to a number divisible by the fudge factor. This can help keep items with similar sizes in order by their labels.
my $bp = Algorithm::BinPack->new(binsize => 4);
my $bp = Algorithm::BinPack->new(binsize => 100, fudge => 10);
add_item
Adds an item to be packed into a bin. Required named arguments are label and size, but any others can be specified, and will be saved. An optional bin argument can be used to manually put an item into the specified bin.
$bp->add_item(label => one, size => 1);
$bp->add_item(label => two, size => 2, desc => The second numeral);
$bp->add_item(label => zero, size => 3, bin => 0);
$bp->add_item(qw(label three size 3));
$bp->add_item(qw(label four size 4 random key));
prefill_bin
(Deprecated method) add_item now knows how to handle the bin argument directly, so this method is redundant.
pack_bins
Packs the items into bins. This method tries to leave as little empty space in each bin as possible. It returns a list of hashrefs with the key size containing the total bin size, and items containing an arrayref holding the items in the bin. Each item is in turn a hashref containing the keys label, size, and any others added to the item. If a fudge factor was used, each item will contain a key fudgesize, which is the size this item was fudged to.
for my $bin ($bp->pack_bins) {
print "Bin size: ", $bin->{size}, "n";
for my $item (@{ $bin->{items} }) {
printf " %-6s %-20sn", $_, $item->{$_} for keys %{ $item };
print " ---n";
}
}
Download (0.004MB)
Added: 2007-05-16 License: Perl Artistic License Price:
891 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above suffix trees algorithm search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed