Revision 82c7c698 fiddle/heuristicbetweennesscentrality/compare.py
fiddle/heuristicbetweennesscentrality/compare.py  

46  46 
# write to file 
47  47 
# FORMAT: ip_address networkx_centrality boost_centrality 
48  48 
print "Compare" 
49 
vertices_with_mismatched_score = list() 

49  50 
with open(MAIN_CODE_DIR + '/output/score_summary_%s.txt' % t, 'w') as output: 
50  51 
for key, nx in sorted_nx_scores: 
51 
weight_basic = weight_basic_scores[key] 

52 
heuristic = heuristic_scores[key] 

53 
output.write('%s\t%s\t%s\t%s\n' % (key, nx, weight_basic, heuristic)) 

52 
weight_basic = float(weight_basic_scores[key]) 

53 
heuristic = float(heuristic_scores[key]) 

54 
nx = float(nx) 

55  
56  
57 
if heuristic != weight_basic: 

58 
vertices_with_mismatched_score.append(key) 

59  
60 
output.write('%s\t%.4f\t%.4f\t%.4f\n' % (key, nx, weight_basic, heuristic)) 

61  
62 
print "Vertices with mismatched score between WBBC and HBC: %s" % len(vertices_with_mismatched_score) 

63  
64 
print sorted(vertices_with_mismatched_score) 

65  
54  66  
55  67 
Also available in: Unified diff