Skip to content

Commit 7b8e9a8

Browse files
committed
update when simple=True
1 parent 1eacef6 commit 7b8e9a8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/sage/graphs/cycle_enumeration.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,16 @@ def _all_cycles_iterator_vertex(self, vertex, starting_vertices=None, simple=Fal
217217
if len(path) > 1 and path[0] == path[-1]:
218218
report = True
219219
if not self.is_directed():
220-
if simple and len(path) <= 3:
221-
report = False
222-
L = len(path)
223-
for i in range(1, L // 2):
224-
if vertex_to_int[path[i]] > vertex_to_int[path[L - i - 1]]:
225-
report = False
226-
break
227-
if vertex_to_int[path[i]] < vertex_to_int[path[L - i - 1]]:
228-
break
220+
if simple:
221+
report = len(path) > 3 and vertex_to_int[path[1]] < vertex_to_int[path[-2]]
222+
else:
223+
L = len(path)
224+
for i in range(1, L // 2):
225+
if vertex_to_int[path[i]] > vertex_to_int[path[L - i - 1]]:
226+
report = False
227+
break
228+
if vertex_to_int[path[i]] < vertex_to_int[path[L - i - 1]]:
229+
break
229230
if report:
230231
if report_weight:
231232
yield (length, path)

0 commit comments

Comments
 (0)