115 size_t size(
size_t i)
const;
118 template <
class OutputIterator>
150 std::ostream&
operator<<(std::ostream& out,
const partition& km);
169 template <
typename D>
181 template <
typename D>
195 template <
typename D>
197 double dissim2 = 0.0;
209 template <
typename D>
211 double dissim2 = 0.0;
224 #endif // PARTITION_H
double total_squared_dissimilarity(const partition &p, D dist)
Compute the total squared dissimilarity between all objects and their medoids.
void write_members(medoid_id m, OutputIterator out)
Write the members of cluster m out to the output stream as object_ids.
std::vector< object_id > medoid_ids
Gives the index of the object that is the ith medoid.
std::vector< std::set< object_id > > cluster_list
Explicit representation of a clustering.
void swap(partition &other)
Fast swap with other patrition objects.
member_writer members(medoid_id m)
double total_dissimilarity(const partition &p, D dist)
Compute the total dissimilarity between all objects and their medoids.
size_t size() const
Total number of objects in the partition.
void sort()
puts medoids in order by their object id, and adjusts cluster_ids accordingly.
std::ostream & operator<<(std::ostream &out, const id_pair< T > &p)
Print out an id_pair as a tuple of its element and its source rank.
virtual ~partition()
Virtual destructor; currently does nothing.
partition(size_t num_objects=0)
Constructor.
size_t object_id
More descriptive type for object index.
bool is_medoid(object_id oi) const
True if and only if object i is a medoid.
size_t medoid_id
More descriptive type for medoid index.
void expand(cluster_list &list, size_t level)
Expand a cluster_list by l levels.
member_writer(partition *_p, medoid_id _m)
void write_members_with_runs(medoid_id m, std::ostream &out)
Write the members of cluster m out to the output stream formatted nicely with hyphenated runs of cons...
void to_cluster_list(cluster_list &list) const
Creates a list of std::sets from the partition info in medoids and cluster_ids.
std::vector< medoid_id > cluster_ids
Gives cluster id (index in medoids) for the ith object.
double mirkin_distance(const cluster_list &c1, const cluster_list &c2)
Mirkin distance bt/w two clusterings.
This represents a partitioning of a data set.
writable structure returned by members() function.
size_t num_clusters() const
Total number of clusters in the partition.