to_networkx

LeafTree.to_networkx()

Return a NetworkX DiGraph object representing the leaf tree.

Edges have a size and distance attribute giving the cluster size threshold and distance at which the child connects to the parent. The child and parent values start from 0 and are row-indices into the leaf tree. The phantom root has itself as a parent to indicate that it is the root of the tree.

Nodes have min_size, max_size, min_distance, max_distance attributes. The min_distance and max_distance columns form a right-open [birth, death) interval, indicating at which distance thresholds clusters exist. The min_size and max_size columns form a left-open (birth, death] interval, indicating at which min cluster size thresholds clusters are leaves. If max_size <= min_size, the cluster is not a leaf.