bundles / scipy latest / scipy / cluster / hierarchy / ClusterNode / pre_order
function
scipy.cluster.hierarchy:ClusterNode.pre_order
Signature
def pre_order ( self , func = <function ClusterNode.<lambda> at 0x0000> ) Summary
Perform pre-order traversal without recursive function calls.
Extended Summary
When a leaf node is first encountered, func is called with the leaf node as its argument, and its result is appended to the list.
For example, the statement
ids = root.pre_order(lambda x: x.id)returns a list of the node ids corresponding to the leaf nodes of the tree as they appear from left to right.
Parameters
func: functionApplied to each leaf ClusterNode object in the pre-order traversal. Given the
i-th leaf node in the pre-order traversaln[i], the result offunc(n[i])is stored inL[i]. If not provided, the index of the original observation to which the node corresponds is used.
Returns
L: listThe pre-order traversal.
Aliases
-
scipy.cluster.hierarchy.ClusterNode.pre_order