Simple graph and tree plotting

plot_graph(graph, *, vertex_positions[, ...])

Plot the given graph.

plot_partition_tree(tree, *[, altitudes, ...])

Plot the given tree as a dendrogram.

print_partition_tree(tree, *[, altitudes, ...])

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 the scipy libraries.

Parameters:
  • tree – Input tree

  • altitudes – Tree node altitudes (will default to attribute_regular_altitudes(tree)() if None)

  • n_clusters – Colorize the n_clusters largest clusters of the dendrogram with different colors

  • lastp – Collapse subtrees containing less than lastp leaves.

Returns:

void