/*************************/ // 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.Copy(), neighborhood.Copy()); } } else { Map.Add(representative.Copy(), neighborhood.Copy()); } }