python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Module clustering :: Class VertexDendrogram
[hide private]

Class VertexDendrogram

source code

object --+    
         |    
Dendrogram --+
             |
            VertexDendrogram

The dendrogram resulting from the hierarchical clustering of the vertex set of a graph.

Instance Methods [hide private]
 
__init__(self, graph, merges, optimal_count=None, params=None, modularity_params=None)
Creates a dendrogram object for a given graph.
source code
 
as_clustering(self, n=None)
Cuts the dendrogram at the given level and returns a corresponding VertexClustering object.
source code
 
__plot__(self, context, bbox, palette, *args, **kwds)
Draws the vertex dendrogram on the given Cairo context
source code

Inherited from Dendrogram: __str__, format, summary

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]

Inherited from Dendrogram (private): _convert_matrix_to_tuple_repr

Properties [hide private]
  optimal_count
Returns the optimal number of clusters for this dendrogram.

Inherited from Dendrogram: merges, names

Inherited from object: __class__

Method Details [hide private]

__init__(self, graph, merges, optimal_count=None, params=None, modularity_params=None)
(Constructor)

source code 

Creates a dendrogram object for a given graph.

Parameters:
  • graph - the graph that will be associated to the clustering
  • merges - the merges performed given in matrix form.
  • optimal_count - the optimal number of clusters where the dendrogram should be cut. This is a hint usually provided by the clustering algorithm that produces the dendrogram. None means that such a hint is not available; the optimal count will then be selected based on the modularity in such a case.
  • params - additional parameters to be stored in this object.
  • modularity_params - arguments that should be passed to Graph.modularity when the modularity is (re)calculated. If the original graph was weighted, you should pass a dictionary containing a weight key with the appropriate value here.
Overrides: object.__init__

as_clustering(self, n=None)

source code 

Cuts the dendrogram at the given level and returns a corresponding VertexClustering object.

Parameters:
  • n - the desired number of clusters. Merges are replayed from the beginning until the membership vector has exactly n distinct elements or until there are no more recorded merges, whichever happens first. If None, the optimal count hint given by the clustering algorithm will be used If the optimal count was not given either, it will be calculated by selecting the level where the modularity is maximal.
Returns:
a new VertexClustering object.

__plot__(self, context, bbox, palette, *args, **kwds)

source code 

Draws the vertex dendrogram on the given Cairo context

See Dendrogram.__plot__ for the list of supported keyword arguments.

Overrides: Dendrogram.__plot__

Property Details [hide private]

optimal_count

Returns the optimal number of clusters for this dendrogram.

If an optimal count hint was given at construction time, this property simply returns the hint. If such a count was not given, this method calculates the optimal number of clusters by maximizing the modularity along all the possible cuts in the dendrogram.

Get Method:
unreachable.optimal_count(self) - Returns the optimal number of clusters for this dendrogram.
Set Method:
unreachable.optimal_count(self, value)

   Home       Trees       Indices       Help