Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 634 Bytes

README.md

File metadata and controls

30 lines (23 loc) · 634 Bytes

k2 tree

A simple implementation of the k2tree in C#.

k2tree provides as easy way to have a two way lookup table in one data structure. Useful for storing vertically partitioned RDF triples.

static void Main(string[] args)
{
    var tree = new K2Tree(32);

    tree.Set(1234, 4321);
    tree.Set(1234, 43214321);
    tree.Set(1234, 9876);

    tree.Set(1111, 9876);
    tree.Set(2222, 9876);
    tree.Set(3333, 9876);

    Console.WriteLine(string.Join(" ", tree.GetByX(1234)));
    Console.WriteLine(string.Join(" ", tree.GetByY(9876)));
    Console.ReadLine();
}

Output

4321 9876 43214321
1111 1234 2222 3333