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

Class OverlappingVertexClustering

       object --+        
                |        
       Clustering --+    
                    |    
OverlappingClustering --+
                        |
       object --+       |
                |       |
       Clustering --+   |
                    |   |
     VertexClustering --+
                        |
                       OverlappingVertexClustering

Overlapping clustering of the vertex set of a graph.

This class extends OverlappingClustering by linking it to a specific Graph object and by optionally storing the modularity score of the clustering.

Modularity in the case of overlapping communities is defined similarly to the nonoverlapping case, but the statement that ``vertex i and j is in the same community'' (expressed by the Kronecker-delta at the end of the formula in the original paper) is replaced by the statement that ``vertex i and j are both contained by at least one of the communities''.


Note: since this class is linked to a Graph, destroying the graph by the del operator does not free the memory occupied by the graph if there exists an OverlappingVertexClustering that references the Graph.

Instance Methods [hide private]
 
__init__(self, graph, membership=None, modularity=None, params={})
Creates an overlapping clustering object for a given graph.
 
recalculate_modularity(self)
Recalculates the stored modularity value.

Inherited from OverlappingClustering: __getitem__, sizes

Inherited from VertexClustering: giant, subgraph

Inherited from VertexClustering (private): _get_graph, _get_modularity

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 VertexClustering: graph, modularity, q

Inherited from Clustering: membership

Inherited from object: __class__

Method Details [hide private]

__init__(self, graph, membership=None, modularity=None, params={})
(Constructor)

 

Creates an overlapping clustering object for a given graph.

Parameters:
  • graph - the graph that will be associated to the clustering
  • membership - the membership list. The length of the list must be equal to the number of vertices in the graph. If None, every vertex is assumed to belong to the same cluster.
  • modularity - the modularity score of the clustering. If None, it will be calculated.
  • params - additional parameters to be stored in this object.
Overrides: object.__init__

recalculate_modularity(self)

 

Recalculates the stored modularity value.

This method must be called before querying the modularity score of the clustering through the class member modularity or q if the graph has been modified (edges have been added or removed) since the creation of the OverlappingVertexClustering object.

Returns:
the new modularity score
Overrides: VertexClustering.recalculate_modularity

To Do: this is pretty slow now, it should eventually be moved to the C layer.