def cluster_depths(cluster):
 depths = {}
 depths[cluster] = 0
 for cluster in preorder(cluster):
  cl_depth = depths[cluster]
  depths.update(dict.fromkeys(cluster.branches, (cl_depth + 1)))
 return depths

def cluster_depths ( cluster ) : depths = { } depths [ cluster ] = 0 for cluster in preorder ( cluster ) : cl_depth = depths [ cluster ] depths . update ( dict . fromkeys ( cluster . branches , ( cl_depth + 1 ) ) ) return depths
return a dictionary mapping :class:tree instances to their depth .