Bijections
Overview
Mathematically, a bijection is a one-to-one and onto function between sets. In this module, we provide the Bijection data type that represents a bijection between finite collections of objects.
A Dict in Julia is not one-to-one. Two different keys might have the same value. A Bijection data structure behaves just like a Dict except that it prevents assigning the same value to two different keys.
Getting started
After using Bijections we create a new Bijection in one of the following ways:
b = Bijection(): This gives a newBijectionin which the keys and values are ofAnytype.b = Bijection{S,T}(): This gives a newBijectionin which the keys are of typeSand the values are of typeT.b = Bijection(x,y): This gives a newBijectionin which the keys are typetypeof(x), the values are typetypeof(y)and the key-value pair(x,y)is inserted into theBijection.b = Bijection(dict::AbstractDict{S, T}): This gives a newBijectionin which the keys are typeS, the values are typeTand all key-value pairs indictare inserted into theBijection.b = Bijection(pair_list::Vector{Pair{S, T}}): Create a newBijectionusing a list of pairs.
See also the Mutable Objects page for additional constructor options.