finished canFold, kDistanceFromRoot and kDistanceFromNode