class VertexDendrogram(Dendrogram):
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 |
Method | as |
Cuts the dendrogram at the given level and returns a corresponding VertexClustering object. |
Method | optimal |
Undocumented |
Property | optimal |
Returns the optimal number of clusters for this dendrogram. |
Instance Variable | _graph |
Undocumented |
Instance Variable | _modularity |
Undocumented |
Instance Variable | _names |
Undocumented |
Instance Variable | _optimal |
Undocumented |
Inherited from Dendrogram
:
Method | __str__ |
Undocumented |
Method | format |
Formats the dendrogram in a foreign format. |
Method | names |
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 |
Converts the matrix representation of a clustering to a tuple representation. |
Method | _item |
Calculates the amount of space needed for drawing an individual vertex at the bottom of the dendrogram. |
Method | _plot |
Plots a dendrogram item to the given Cairo context |
Method | _traverse |
Conducts an inorder traversal of the merge tree. |
Instance Variable | _merges |
Undocumented |
Instance Variable | _nitems |
Undocumented |
Instance Variable | _nmerges |
Undocumented |
igraph.clustering.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 | 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 | 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. |
igraph.clustering.Dendrogram.__plot__
Draws the vertex dendrogram on the given Cairo context
See Dendrogram.__plot__
for the list of supported keyword arguments.
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. |
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.