Package igraph :: Module clustering :: Class OverlappingClustering
[hide private]
[frames] | no frames]

Class OverlappingClustering

object --+    
         |    
Clustering --+
             |
            OverlappingClustering
Known Subclasses:

Extension of Clustering that allows for overlapping clusters.

With overlapping clusters, a single vertex can be the member of multiple clusters (or even none of them). Therefore, each item of the membership vector is a list, set or tuple containing the cluster indices for all vertices.

Members of an individual cluster can be accessed by the [] operator:

>>> cl = Clustering([(0,), (0,), (0,1), (1,), (1,), ()])
>>> cl[0]
[0, 1, 2]
>>> cl[1]
[2, 3, 4]

The membership vector can be accessed by the membership property:

>>> cl.membership
[frozenset([0]), frozenset([0]), frozenset([0,1]), frozenset([1]), frozenset([1]), frozenset([])]

The number of clusters can be retrieved by the len function:

>>> len(cl)
2
Instance Methods [hide private]
 
__getitem__(self, idx)
Returns the members of the specified cluster.
 
__init__(self, membership, params={})
Constructor.
 
sizes(self, *args)
Returns the size of given clusters.

Inherited from Clustering: __len__, size, size_histogram

Inherited from Clustering (private): _get_membership

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from Clustering: membership

Inherited from object: __class__

Method Details [hide private]

__getitem__(self, idx)
(Indexing operator)

 

Returns the members of the specified cluster.

Parameters:
  • idx - the index of the cluster
Returns:
the members of the specified cluster as a list
Raises:
  • IndexError - if the index is out of bounds
Overrides: Clustering.__getitem__

__init__(self, membership, params={})
(Constructor)

 

Constructor.

Parameters:
  • membership - the membership list -- that is, the cluster index in which each element of the set belongs to.
  • params - additional parameters to be stored in this object's dictionary.
Overrides: object.__init__

sizes(self, *args)

 

Returns the size of given clusters.

Parameters:
  • idxs - the cluster indices in which we are interested. If None, defaults to all clusters
Overrides: Clustering.sizes