Simple graph and tree plotting¶
|
Plot the given graph. |
|
Plot the given tree as a dendrogram. |
|
Print a partition tree in ASCII format. |
-
plot_graph
(graph, *, vertex_positions, vertex_labels=None)[source]¶ Plot the given graph.
Requires the
matplotlib
library.- Parameters:
graph – Input graph
vertex_positions – 2d array containing the coordinates of each vertex of the graph
labels – Optional: vertex labels
- Returns:
None
-
plot_partition_tree
(tree, *, altitudes=None, n_clusters=0, lastp=30)[source]¶ Plot the given tree as a dendrogram.
Requires the
matplotlib
and thescipy
libraries.- Parameters:
tree – Input tree
altitudes – Tree node altitudes (will default to
attribute_regular_altitudes(tree)()
ifNone
)n_clusters – Colorize the
n_clusters
largest clusters of the dendrogram with different colorslastp – Collapse subtrees containing less than
lastp
leaves.
- Returns:
void