commit 82c7c698645c5f140850f115615f25d9cda38018
Author: Quynh PX Nguyen
Date: Wed Dec 30 04:33:43 2015 +0700
[f] WBBC = HBC :)
diff --git a/fiddle/heuristic-betweenness-centrality/compare.py b/fiddle/heuristic-betweenness-centrality/compare.py
index b03b5d1..95d3baa 100644
--- a/fiddle/heuristic-betweenness-centrality/compare.py
+++ b/fiddle/heuristic-betweenness-centrality/compare.py
@@ -46,10 +46,22 @@ if __name__ == '__main__':
# write to file
# FORMAT: ip_address networkx_centrality boost_centrality
print "Compare"
+ vertices_with_mismatched_score = list()
with open(MAIN_CODE_DIR + '/output/score_summary_%s.txt' % t, 'w') as output:
for key, nx in sorted_nx_scores:
- weight_basic = weight_basic_scores[key]
- heuristic = heuristic_scores[key]
- output.write('%s\t%s\t%s\t%s\n' % (key, nx, weight_basic, heuristic))
+ weight_basic = float(weight_basic_scores[key])
+ heuristic = float(heuristic_scores[key])
+ nx = float(nx)
+
+
+ if heuristic != weight_basic:
+ vertices_with_mismatched_score.append(key)
+
+ output.write('%s\t%.4f\t%.4f\t%.4f\n' % (key, nx, weight_basic, heuristic))
+
+ print "Vertices with mismatched score between WBBC and HBC: %s" % len(vertices_with_mismatched_score)
+
+ print sorted(vertices_with_mismatched_score)
+