Skip to content
c80k edited this page Jan 3, 2018 · 6 revisions

Immutable relations for .NET

NuGet link: https://www.nuget.org/packages/ImmutableRelations

This repository provides a C# implementation for immutable, n-ary relations. In all brevity:

  • Relation is meant in the mathematical/computational/database sense: A set of tuples. In particular, the data structure is intended to serve as an efficient in-memory implementation of the binary-relational storage structure that R. A. Frost described more than 3.5 decades ago (despite that the library author would call the described relation ternary rather than binary).
  • n-ary means that the data structure can principally manage relations of any arity. The most common use case is surely modeling binary relations. However, it also useful for unary relations - in which case the data structure degenerates simply to a (hash) set. Ternary relations are supported as well. Relations of higher arity can be supported by implementing a custom version of the ITupleAdapter<TupleType> interface. Disclaimer: Managing high-dimensional data is a challenging topic. Don't expect too much in terms of space/time efficiency when going beyond 3 dimensions.
  • Immutable means that each modification of the data structure returns a new instance of it, keeping the original one unmodified. You may already know this principle from functional programming or System.Collections.Immutable (part of .NET Core and available on NuGet.org).

Clone this wiki locally