summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaochen Wu <wuhaochen42@gmail.com>2015-10-17 14:55:50 -0700
committerHaochen Wu <wuhaochen42@gmail.com>2015-10-17 14:55:50 -0700
commit1f8bec7435e73032a0a11205f724c063450da4d2 (patch)
tree9c949f75861359ae3f0f54183c598ed633272cdd
parent5b76751ae3d6ae20d827692d2f26ad2e71d084b8 (diff)
downloadnetworkx-1f8bec7435e73032a0a11205f724c063450da4d2.tar.gz
cast number types
-rw-r--r--networkx/algorithms/reciprocity.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/networkx/algorithms/reciprocity.py b/networkx/algorithms/reciprocity.py
index 0e7cf964..eecad382 100644
--- a/networkx/algorithms/reciprocity.py
+++ b/networkx/algorithms/reciprocity.py
@@ -59,7 +59,7 @@ def _reciprocity_iter(G,nodes):
if n_total == 0:
raise NetworkXError('Not defined for isolated nodes.')
- reciprocity = 2*len(overlap)/float(n_total)
+ reciprocity = 2.0*float(len(overlap))/float(n_total)
yield (node,reciprocity)
@not_implemented_for('undirected','multigraph')
@@ -78,4 +78,4 @@ def overall_reciprocity(G):
if n_all_edge == 0:
raise NetworkXError("Not defined for empty graphs")
- return n_overlap_edge/float(n_all_edge) \ No newline at end of file
+ return float(n_overlap_edge)/float(n_all_edge)