# ``igraph`.`VertexDendrogram``

class documentation

`class VertexDendrogram(Dendrogram): (source)`

Constructor: `VertexDendrogram(graph, merges, optimal_count, modularity_params)`

View In Hierarchy

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

Method | `__init__` | Creates a dendrogram object for a given graph.
Method | `__plot__` | Draws the vertex dendrogram on the given Cairo context or matplotlib Axes
Method | `as_clustering` | Cuts the dendrogram at the given level and returns a corresponding `VertexClustering` object.
Method | `optimal_count.setter` | Undocumented
Property | `optimal_count` | Returns the optimal number of clusters for this dendrogram.
Instance Variable | `_graph` | Undocumented
Instance Variable | `_modularity_params` | Undocumented
Instance Variable | `_names` | Undocumented
Instance Variable | `_optimal_count` | Undocumented

Inherited from `Dendrogram`:

Method | `__str__` | Undocumented
Method | `format` | Formats the dendrogram in a foreign format.
Method | `names.setter` | Sets the names of the nodes in the dendrogram
Method | `summary` | Returns the summary of the dendrogram.
Property | `merges` | Returns the performed merges in matrix format
Property | `names` | Returns the names of the nodes in the dendrogram
Static Method | `_convert_matrix_to_tuple_repr` | Converts the matrix representation of a clustering to a tuple representation.
Method | `_traverse_inorder` | Conducts an inorder traversal of the merge tree.
Instance Variable | `_merges` | Undocumented
Instance Variable | `_nitems` | Undocumented
Instance Variable | `_nmerges` | Undocumented

def __init__(self, graph, merges, optimal_count=None, modularity_params=None): (source)
overrides `igraph.Dendrogram.__init__`

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.
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.

def __plot__(self, backend, context, *args, **kwds): (source)
overrides `igraph.Dendrogram.__plot__`

Draws the vertex dendrogram on the given Cairo context or matplotlib Axes

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

def as_clustering(self, n=None): (source)

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.

@optimal_count.setter
def optimal_count(self, value): (source)

Undocumented

@property
optimal_count = (source)

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.

_graph = (source)

Undocumented

_modularity_params: `dict` = (source)

Undocumented

_names = (source)
overrides `igraph.Dendrogram._names`

Undocumented

_optimal_count = (source)

Undocumented