Classes | Public Member Functions | Public Attributes

partition Struct Reference

This represents a partitioning of a data set. More...

#include <partition.h>

Inheritance diagram for partition:
Inheritance graph
[legend]

List of all members.

Classes

struct  member_writer
 writable structure returned by members() function. More...

Public Member Functions

 partition (size_t num_objects=0)
 Constructor.
virtual ~partition ()
 Virtual destructor; currently does nothing.
bool is_medoid (object_id oi) const
 True if and only if object i is a medoid.
void to_cluster_list (cluster_list &list) const
 Creates a list of std::sets from the partition info in medoids and cluster_ids.
void swap (partition &other)
 Fast swap with other patrition objects.
void sort ()
 puts medoids in order by their object id, and adjusts cluster_ids accordingly.
size_t size () const
 Total number of objects in the partition.
size_t num_clusters () const
 Total number of clusters in the partition.
size_t size (size_t i) const
 Number of objects in cluster i.
template<class OutputIterator >
void write_members (medoid_id m, OutputIterator out)
 Write the members of cluster m out to the output stream as object_ids.
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 consecutive numbers.
member_writer members (medoid_id m)

Public Attributes

std::vector< object_idmedoid_ids
 Gives the index of the object that is the ith medoid.
std::vector< medoid_idcluster_ids
 Gives cluster id (index in medoids) for the ith object.

Detailed Description

This represents a partitioning of a data set.

The data set consists of objects, each of which has an associated non-negative object_id.

A partitioning divides a data set into groups, or clusters, and the partition object stores information about these clusters internally. In particular, it contains a vector of object_ids that indicate the representative object, or medoid of each cluster. It also contains a vector of medoid_ids indicating which cluster each object in the data set belongs to.

Partition objects can be converted to a cluster_list, which is a more explicit representation of the partitioning.

Definition at line 76 of file partition.h.


Constructor & Destructor Documentation

partition ( size_t  num_objects = 0 )

Constructor.

Can optionall supply the number of objects to be partitioned and this will start out with one cluster containing all of them.

Definition at line 51 of file partition.cpp.

~partition (  ) [virtual]

Virtual destructor; currently does nothing.

Definition at line 56 of file partition.cpp.


Member Function Documentation

bool is_medoid ( object_id  oi ) const [inline]

True if and only if object i is a medoid.

Definition at line 94 of file partition.h.

member_writer members ( medoid_id  m ) [inline]

Definition at line 137 of file partition.h.

size_t num_clusters (  ) const [inline]

Total number of clusters in the partition.

Definition at line 112 of file partition.h.

size_t size (  ) const [inline]

Total number of objects in the partition.

Definition at line 109 of file partition.h.

size_t size ( size_t  i ) const

Number of objects in cluster i.

Definition at line 119 of file partition.cpp.

void sort (  )

puts medoids in order by their object id, and adjusts cluster_ids accordingly.

Definition at line 74 of file partition.cpp.

void swap ( partition other )

Fast swap with other patrition objects.

Definition at line 68 of file partition.cpp.

void to_cluster_list ( cluster_list list ) const

Creates a list of std::sets from the partition info in medoids and cluster_ids.

Definition at line 59 of file partition.cpp.

void write_members ( medoid_id  m,
OutputIterator  out 
) [inline]

Write the members of cluster m out to the output stream as object_ids.

Definition at line 119 of file partition.h.

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 consecutive numbers.


Member Data Documentation

std::vector<medoid_id> cluster_ids

Gives cluster id (index in medoids) for the ith object.

clusterid[i] == id of cluster of which object i is a member. medoids[clusterid[i]] == representative of that cluster.

Definition at line 84 of file partition.h.

std::vector<object_id> medoid_ids

Gives the index of the object that is the ith medoid.

medoids[i] == index in object array for last call to findClusters()

Definition at line 79 of file partition.h.


The documentation for this struct was generated from the following files:
Muster. Copyright © 2010, Lawrence Livermore National Laboratory, LLNL-CODE-433662.
Distribution of Muster and its documentation is subject to terms of the Muster LICENSE.
Generated on Mon Dec 20 2010 using Doxygen 1.7.2