/* Copyright (c) 2003-2015 Tommi Junttila Released under the GNU Lesser General Public License version 3.
This file is part of bliss.
bliss is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3 of the License.
bliss is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with bliss. If not, see <http://www.gnu.org/licenses/>.
*/
namespace bliss_digraphs {
/** \internal * \brief A class for representing orbit information. * * Given a set {0,...,N-1} of N elements, represent equivalence * classes (that is, unordered partitions) of the elements. * Supports only equivalence class merging, not splitting. * Merging two classes requires time O(k), where k is the number of * the elements in the smaller of the merged classes. * Getting the smallest representative in a class (and thus testing * whether two elements belong to the same class) is a constant time operation.
*/ class Orbit
{ class OrbitEntry
{ public: unsignedint element;
OrbitEntry *next; unsignedint size;
};
public: /** * Create a new orbit information object. * The init() function must be called next to actually initialize * the object.
*/
Orbit();
~Orbit();
/** * Initialize the orbit information to consider sets of \a N elements. * It is required that \a N > 0. * The orbit information is reset so that each element forms * an orbit of its own. * Time complexity is O(N). * \sa reset()
*/ void init(constunsignedint N);
/** * Reset the orbits so that each element forms an orbit of its own. * Time complexity is O(N).
*/ void reset();
/** * Merge the orbits of the elements \a e1 and \a e2. * Time complexity is O(k), where k is the number of elements in * the smaller of the merged orbits.
*/ void merge_orbits(unsignedint e1, unsignedint e2);
/** * Is the element \a e the smallest element in its orbit? * Time complexity is O(1).
*/ bool is_minimal_representative(unsignedint e) const;
/** * Get the smallest element in the orbit of the element \a e. * Time complexity is O(1).
*/ unsignedint get_minimal_representative(unsignedint e) const;
/** * Get the number of elements in the orbit of the element \a e. * Time complexity is O(1).
*/ unsignedint orbit_size(unsignedint e) const;
/** * Get the number of orbits. * Time complexity is O(1).
*/ unsignedint nof_orbits() const {return _nof_orbits; }
};
} // namespace bliss_digraphs
#endif
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.