Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.algorithms.cluster
Class ClusterSet

    java.lang.Object
      edu.uci.ics.jung.algorithms.cluster.ClusterSet

Direct Known Subclasses:
  EdgeClusterSet, VertexClusterSet

public abstract class ClusterSet
extends Object

A data structure representing the clusters, connected set of vertices (or edges), in a graph. The clusters can be retrieved based upon their position index in the collection. Also, given a vertex (or edge) the corresponding clusters can be retrieved. There is no requirement that the union of the set of vertices (or edges) in each cluster needs to equal the set of all vertices in the graph.

Author:
  Scott White

Constructor Summary
`ClusterSet(ArchetypeGraph underlyingGraph)` Creates a new instance.

Method Summary
`void` | `addCluster(Set elements)` Adds a new cluster to the collection.
`protected void` | `checkLegality(Element e)`
`abstract ClusterSet` | `createEquivalentClusterSet(Graph anotherGraph)` Returns the corresponding cluster set in the other graph.
`Set` | `getCluster(int index)` Given the cluster's position in the list (0-based), retrieve the cluster (set of vertices)
`abstract Graph` | `getClusterAsNewSubGraph(int index)` Constructs a new graph from the given cluster
`Set` | `getClusters(Element element)` Given a vertex (or edge), retrieves the clusters which that vertex (or edge) belongs to if any
`ArchetypeGraph` | `getUnderlyingGraph()`
`Iterator` | `iterator()` Returns an iterator to the component list.
`int` | `size()` the size of the cluster collection.
`void` | `sort()` Sorts the clusters by size.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClusterSet

    public ClusterSet(ArchetypeGraph underlyingGraph)

  Creates a new instance.

Method Detail

### addCluster

    public void addCluster(Set elements)

  Adds a new cluster to the collection.

  Parameters:
    `elements` - the set of vertices (or edges) comprising a component to be added

### checkLegality

    protected void checkLegality(Element e)

### getClusterAsNewSubGraph

    public abstract Graph getClusterAsNewSubGraph(int index)

  Constructs a new graph from the given cluster

  Parameters:
    `index` - the position index of the cluster in the collection
  Returns:
    a new graph representing the cluster

### createEquivalentClusterSet

    public abstract ClusterSet createEquivalentClusterSet(Graph anotherGraph)

  Returns the corresponding cluster set in the other graph. If any of the vertices (or edges) in the specified graph are not equivalent to the corresponding vertices (or edges) in this graph then an IllegalArgumentException is thrown.

  Parameters:
    `anotherGraph` - another graph whose corresponding clusters are to be retrieved
  Returns:
    the set of clsuters for the new graph

### getClusters

    public Set getClusters(Element element)

  Given a vertex (or edge), retrieves the clusters which that vertex (or edge) belongs to if any

  Parameters:
    `element` - the vertex (or edge) whose cluster is to be retrieved.
  Returns:
    the set of clusters (set of non-overlapping vertices (or edges))

### getCluster

    public Set getCluster(int index)

  Given the cluster's position in the list (0-based), retrieve the cluster (set of vertices)

  Parameters:
    `index` - the 0-based index of the cluster in the list.
  Returns:
    the set of vertices (or edges) comprising the cluster

### iterator

    public Iterator iterator()

  Returns an iterator to the component list.

  Returns:
    the iterator to the component list

### size

    public int size()

  the size of the cluster collection.

  Returns:
    the number of clusters in the collection

### sort

    public void sort()

  Sorts the clusters by size.

### getUnderlyingGraph

    public ArchetypeGraph getUnderlyingGraph()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD