change in random number max logic

This commit is contained in:
Vighnesh Birodkar
2014-10-04 22:37:12 +05:30
parent 3a9df73590
commit 02fec246ea
+3 -2
View File
@@ -96,11 +96,12 @@ class RAG(nx.Graph):
src_nbrs = set(self.neighbors(src))
dst_nbrs = set(self.neighbors(dst))
neighbors = (src_nbrs & dst_nbrs) - set([src, dst])
n = self.number_of_nodes()
if not in_place:
# Randomly select an id
new = random.randint(1, 99999999)
new = random.randint(1, 2*n)
while new in self:
new = random.randint(1, 99999999)
new = random.randint(1, 2*n)
self.add_node(new)
for neighbor in neighbors: