An image could be described with local features like SIFT and with those features, images could be represented as "Bag-of-Visual-Words"(BVW). This representation has been widely used in content based image retrieval. Comparing BVW of two images is usually done in Euclidean space, like Euclidean distance or weighted variants. Neither of these methods consider the inter cluster relations. If there is a feature in one image without any match in all the clusters of another image's features, there will be no score for that feature. But, there are still some match in neighbor clusters. In this paper, we use dynamic programming to calculate full inter cluster distance map and with the distance, we can evaluate a feature in neighbor clusters. Our proposed method is evaluated in Caltech 101 database and experiments show that our method generally exceeds the method that don't consider inter cluster distance.