diff --git a/cyaron/graph.py b/cyaron/graph.py index eddefcc..9de2cc3 100644 --- a/cyaron/graph.py +++ b/cyaron/graph.py @@ -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()) @@ -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 diff --git a/setup.py b/setup.py index 2f347da..f5b0669 100644 --- a/setup.py +++ b/setup.py @@ -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',