/*************************/ // Basic operations /*************************/ // When adding a new entry we check if the neighborhood is already contained in the set // If true, then we might replace the previous representative that is not connected to this neighborhood if the new one is lexicographically smaller public void Update(BitSet representative, BitSet neighborhood) { if (_map.ContainsValue(neighborhood)) { BitSet previousRep = _map.Reverse[neighborhood]; if (representative.IsLexicographicallySmaller(previousRep)) { _map.Remove(previousRep, neighborhood); _map.Add(representative, neighborhood); } } else { _map.Add(representative, neighborhood); } }