Skip to content

Commit f0b5d7c

Browse files
committed
Graph generation bug fix, version bump to 0.2.7
1 parent 7768c9f commit f0b5d7c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cyaron/graph.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ def graph(point_count, edge_count, **kwargs):
249249
weight_limit[0], weight_limit[1]))
250250
graph = Graph(point_count, directed)
251251
used_edges = set()
252-
for i in range(edge_count):
252+
i = 0
253+
while i < edge_count:
253254
u = random.randint(1, point_count)
254255
v = random.randint(1, point_count)
255256

256257
if (not self_loop and u == v) or (not repeated_edges and (u, v) in used_edges):
257258
# Then we generate a new pair of nodes
258-
i -= 1
259259
continue
260260

261261
graph.add_edge(u, v, weight=weight_gen())
@@ -264,6 +264,8 @@ def graph(point_count, edge_count, **kwargs):
264264
used_edges.add((u, v))
265265
if not directed:
266266
used_edges.add((v, u))
267+
268+
i += 1
267269
return graph
268270

269271
@staticmethod

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='cyaron',
5-
version='0.2.6',
5+
version='0.2.7',
66
keywords='olympic informatics luogu aqours cyaron lovelive sunshine online judge',
77
description='CYaRon: Yet Another Random Olympic-iNformatics test data generator, A library for automatically generating test data for Online Judge, Olympic Informatics or automatic application testing',
88
license='LGPLv3',

0 commit comments

Comments
 (0)