Search code examples
c#data-structuressuffix-tree

Looking for the suffix tree implementation in C#?


I've implemented a basic search for a research project. I'm trying to make the search more efficient by building a suffix tree. I'm interested in a C# implementation of the Ukkonen algorith. I don't want to waste time rolling my own if such implementation exists.


Solution

  • Hei, just finished implementing .NET (c#) library containing different trie implementations. Among them:

    • Classical trie
    • Patricia trie
    • Suffix trie
    • A trie using Ukkonen's algorithm

    I tried to make source code easy readable. Usage is also very straight forward:

    using Gma.DataStructures.StringSearch;
    
    ...
    
    var trie = new UkkonenTrie<int>(3);
    //var trie = new SuffixTrie<int>(3);
    
    trie.Add("hello", 1);
    trie.Add("world", 2);
    trie.Add("hell", 3);
    
    var result = trie.Retrieve("hel");
    

    The library is well tested and also published as TrieNet NuGet package.

    See github.com/gmamaladze/trienet