Skip to content

Commit

Permalink
Graph generation bug fix, version bump to 0.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-toto committed May 22, 2017
1 parent 7768c9f commit f0b5d7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cyaron/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ def graph(point_count, edge_count, **kwargs):
weight_limit[0], weight_limit[1]))
graph = Graph(point_count, directed)
used_edges = set()
for i in range(edge_count):
i = 0
while i < edge_count:
u = random.randint(1, point_count)
v = random.randint(1, point_count)

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

graph.add_edge(u, v, weight=weight_gen())
Expand All @@ -264,6 +264,8 @@ def graph(point_count, edge_count, **kwargs):
used_edges.add((u, v))
if not directed:
used_edges.add((v, u))

i += 1
return graph

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='cyaron',
version='0.2.6',
version='0.2.7',
keywords='olympic informatics luogu aqours cyaron lovelive sunshine online judge',
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',
license='LGPLv3',
Expand Down

0 comments on commit f0b5d7c

Please sign in to comment.