diff --git a/dsalgo.py b/dsalgo.py
index c091c4b2ca4c7b1e9e81d5f99b8bef0958ee54b0..7e6533a0539a6dd0321cc5cc85736fdc7e924db9 100755
--- a/dsalgo.py
+++ b/dsalgo.py
@@ -237,6 +237,7 @@ def exact_densest(G: nx.Graph):
 
 def create_flow_network(G, guess):
     m = G.number_of_edges()
+    m = int(G.size(weight="weight"))
     G = nx.DiGraph(G)
     
     H = G.copy()