Skip to content

Anatree: A Fast Data Structure for Anagrams

License

Notifications You must be signed in to change notification settings

SSoelvsten/anatree

Repository files navigation

Anatree

LGPL-3.0 License   test   codecov

The (mixed) Anatree [Reams2012] provides a data structure optimised for solving some subset of Constraint Satisfaction Problems (CPSs), e.g. finding within a dictionary all (sub)anagrams of a given word.

Usage

The data structure is implemented in a single header-only file, src/anatree.h that you can link up to directly.

For ease of use, we provide the following make targets.

Make Target Description
help Prints out a list of all targets
clean Removes all build files
install Installs Anatree
uninstall Removes the installed files once more
test Builds and runs the unit tests
docs Builds the Doxygen Documentation

CMake Dependency

The entire project is set up to be built with CMake. Indeed, we recommend that you include this Anatree repository as a submodule of your own project as follows

git submodule add -b header-only https://github.com/ssoelvsten/anatree external/anatree
git submodule update --init

Then within your own project you can just do

add_subdirectory(external/anatree)

add_executable(<target> <source>)
target_link_libraries(<target> anatree)

Installation

The Anatree library can also be installed to /usr/local/include/ (or your machine's equivalent) by use of the install make target or with the CMake target of the same name.

Unit Tests

The anatree is tested with the Bandit unit testing framework. If you did not already clone this repository recursively to include submodules, please do

git submodule update --init --recursive

You can run the unit tests using the test make target mentioned above or with the following commands.

mkdir -p build/
cd build/
cmake -D CMAKE_BUILD_TYPE=Debug ..
make anatree_test
./test/anatree_test
cd ..

License

The software and documentation files in this repository are provided under the GNU Lesser General Public License v3.0 .

References

  • [Reams2012] Charles Reams. 2012. Anatree: A Fast Data Structure for Anagrams. ACM J. Exp. Algorithmics 17, Article 1.1 (2012), 16 pages.