public double tsim(Venue venue1, Venue venue2) {
		// categories1 contains the categories of venue1.
		Collection<Category> categories1 = new ArrayList<Category>();
		for (String categoryId : venue1.getCategories().keySet()) {
			categories1.add(categories.get(categoryId));
		}
		
		// categories2 contains the categories of venue2.
		Collection<Category> categories2 = new ArrayList<Category>();
		for (String categoryId : venue2.getCategories().keySet()) {
			categories2.add(categories.get(categoryId));
		}
		
		// maxSimilarity is the maximum similarity obtained for all pairs of
		// categories containing a category from venue1 and a category from
		// venue2.
		double maxSimilarity = 0;

		// Computation of maxSimilarity by iterating on the categories of
		// venue1 and the categories of venue2.
		for (Category category1 : categories1) {
			for (Category category2 : categories2) {
				// The similarity between two categories is defined as 
				// 1/(1 + distance) where distance is the number of edges
				// separating these two categories in the category tree.
				double similarity = (double) 1/(1 + Category.distance(category1, category2));
				if (similarity > maxSimilarity) {
					maxSimilarity = similarity;
				}
			}
		}
		
		return maxSimilarity;
	}