Class ClusteringGenerator

Class Documentation

class ClusteringGenerator

Provides several methods for generating special clusterings.

Public Functions

Partition makeSingletonClustering(const Graph &G)

Make a singleton clustering of Graph G, i.e. a clustering in which every node belongs to its own cluster.

Parameters:

G – The graph.

Returns:

A Partition in which every node belongs to its own cluster.

Partition makeOneClustering(const Graph &G)

Make a 1-clustering of Graph G, i.e. a clustering in which all nodes belong to the same cluster.

Parameters:

G – The graph.

Returns:

A Partition in which all nodes belong to the same cluster.

Partition makeRandomClustering(const Graph &G, count k)

Make a clustering of Graph G with k clusters to which the nodes are randomly assigned.

Parameters:
  • G – The graph.

  • k – The amount of clusters.

Returns:

A Partition with k clusters and each node randomly assigned to one of them.

Partition makeContinuousBalancedClustering(const Graph &G, count k)

Make a clustering of Graph G with k clusters. The first n/k nodes are assigned to the first cluster, the next n/k nodes to the second cluster and so on.

Parameters:
  • G – The graph.

  • k – The amount of clusters.

Returns:

A Partition with k clusters and each node assigned like described above.

Partition makeNoncontinuousBalancedClustering(const Graph &G, count k)

Make a clustering of a Graph G with k clusters. Each node u is assigned to cluster u % k. When the number of nodes n is quadratic and k is the square root of n, this clustering is complementary to the continuous balanced clustering in the sense that no pair of nodes that is in the same cluster in one of the clusterings is in the same cluster in the other clustering.

Parameters:
  • G – The graph.

  • k – The amount of clusters.

Returns:

A Partition with k clusters and each node assigned as described above.