def __allocate_clusters(self):
leaf_blocks = self.__directory.get_leafs()<EOL>unhandled_block_indexes = set([i for i in range(len(leaf_blocks)) if leaf_blocks[i].get_density() > self.__density_threshold])<EOL>current_block = self.__find_block_center(leaf_blocks, unhandled_block_indexes)<EOL>cluster_index = <NUM_LIT:0><EOL>while current_block is not None:<EOL><INDENT>if current_block.get_density() <= self.__density_threshold or len(current_block) <= self.__amount_threshold:<EOL><INDENT>break<EOL><DEDENT>self.__expand_cluster_block(current_block, cluster_index, leaf_blocks, unhandled_block_indexes)<EOL>current_block = self.__find_block_center(leaf_blocks, unhandled_block_indexes)<EOL>cluster_index += <NUM_LIT:1><EOL><DEDENT>self.__store_clustering_results(cluster_index, leaf_blocks)<EOL>
!
        @brief Performs cluster allocation using leafs of tree in BANG directory (the smallest cells).