Returns true iff tr is currently empty. O(1).
Returns the current number of pairs in tr. O(1).
Returns an arbitrary pair of the current contents of tr. Specifically, on a
nonempty relation, returns three values: an arbitrary key, an arbitrary value associated with that
key, and true; on an empty relation, returns nil, nil, and false. O(1).
Returns true iff tr currently contains a pair whose key is x and whose value is y. O(log n).
Returns the set of values to which tr currently maps key x. If tr has no pairs with key x, simply returns an empty set. The returned set is of the same implementation (WB or CHAMP) as tr, and its comparison function is the value comparison function of r. This operation copies the set being returned. O(m + log n), where m is the size of the returned set.
Constructs inverse. Returns the set of keys that tr maps to value y. If r has no pairs with value y, simply returns an empty set. The returned set is of the same implementation (WB or CHAMP) as r, and its comparison function is the key comparison function of r. This operation copies the set being returned. Amortized O(m + log n), where m is the size of the returned set.
Removes all pairs from tr, resetting it to the empty state. O(1).
Modifies tr so that it also maps x to y. Has no effect if this was already the case. Returns tr. O(log n).
Modifies tr so that it does not map x to y. Has no effect if this was already the case. Returns tr. O(log n).