summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networkx/classes/graph.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/networkx/classes/graph.py b/networkx/classes/graph.py
index 7ea3b91c..fcdc7fd9 100644
--- a/networkx/classes/graph.py
+++ b/networkx/classes/graph.py
@@ -13,6 +13,7 @@ For directed graphs see DiGraph and MultiDiGraph.
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
+from __future__ import division
from copy import deepcopy
import networkx as nx
from networkx.exception import NetworkXError
@@ -1584,11 +1585,7 @@ class Graph(object):
>>> G.size(weight='weight')
6.0
"""
- s = sum(dict(self.degree(weight=weight)).values()) / 2
- if weight is None:
- return int(s)
- else:
- return float(s)
+ return sum(dict(self.degree(weight=weight)).values()) / 2
def number_of_edges(self, u=None, v=None):
"""Return the number of edges between two nodes.