small bug fix in src/nepi/util/netgraph.py
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Wed, 3 Sep 2014 11:57:38 +0000 (13:57 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Wed, 3 Sep 2014 11:57:38 +0000 (13:57 +0200)
src/nepi/util/netgraph.py

index 6d68622..c04f94d 100644 (file)
@@ -19,6 +19,7 @@
 
 import ipaddr
 import networkx
+import math
 import random
 
 class TopologyType:
@@ -325,8 +326,8 @@ class NetGraph(object):
         # The ladder is a special case because is not symmetric.
         if self.topo_type == TopologyType.LADDER:
             total_nodes = self.order/2
-            leaf1 = str(total_nodes - 1)
-            leaf2 = str(nodes - 1)
+            leaf1 = str(total_nodes)
+            leaf2 = str(total_nodes - 1)
             leaves = [leaf1, leaf2]
             source = leaves.pop(random.randint(0, len(leaves) - 1))
         else: