def calculateMergeAbleAndNotMergeableBusinessesAcrossTime(cross_time_graphs, parent_graph, bnss_score_all_time_map): # calculate interesting businesses across time mergeable_businessids = dict() not_mergeable_businessids = dict() for bnss_key in bnss_score_all_time_map.iterkeys(): time_score_map = bnss_score_all_time_map[bnss_key] scores = [time_score_map[time_key][1] for time_key in time_score_map.iterkeys()] good_scores = OldGraphUtil.rm_outlier(scores) # print 'IN: ', scores # REMOVE # print 'OP: ', good_scores # print '*'*10 for time_key in time_score_map.iterkeys(): score = time_score_map[time_key][1] if(score in good_scores): if time_key not in mergeable_businessids: mergeable_businessids[time_key] = set() mergeable_businessids[time_key].add(bnss_key) else: if time_key not in not_mergeable_businessids: not_mergeable_businessids[time_key] = set() not_mergeable_businessids[time_key].add(bnss_key) for time_key in not_mergeable_businessids.iterkeys(): print 'Interesting businesses in time:', time_key,len(not_mergeable_businessids[time_key]) for time_key in mergeable_businessids.iterkeys(): print 'Not Interesting businesses in time:', time_key,len(mergeable_businessids[time_key]) return (mergeable_businessids,not_mergeable_businessids)