Skip to content

Commit e0528b7

Browse files
committed
returned weight may be fractional
1 parent 0ac4e57 commit e0528b7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/sage/graphs/cycle_enumeration.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ def _all_simple_cycles_iterator_edge(self, edge, max_length=None,
265265
sage: g = graphs.Grid2dGraph(2, 5).to_directed()
266266
sage: it = g._all_simple_cycles_iterator_edge(((0, 0), (0, 1), None), report_weight=True)
267267
sage: for i in range(5): print(next(it))
268-
(2, [(0, 0), (0, 1), (0, 0)])
269-
(4, [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)])
270-
(6, [(0, 0), (0, 1), (0, 2), (1, 2), (1, 1), (1, 0), (0, 0)])
271-
(8, [(0, 0), (0, 1), (0, 2), (0, 3), (1, 3), (1, 2), (1, 1), (1, 0), (0, 0)])
272-
(10, [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 4), (1, 3), (1, 2), (1, 1), (1, 0), (0, 0)])
268+
(2.0, [(0, 0), (0, 1), (0, 0)])
269+
(4.0, [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)])
270+
(6.0, [(0, 0), (0, 1), (0, 2), (1, 2), (1, 1), (1, 0), (0, 0)])
271+
(8.0, [(0, 0), (0, 1), (0, 2), (0, 3), (1, 3), (1, 2), (1, 1), (1, 0), (0, 0)])
272+
(10.0, [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 4), (1, 3), (1, 2), (1, 1), (1, 0), (0, 0)])
273273
274274
The function works for undirected graphs as well::
275275
@@ -841,12 +841,12 @@ def all_simple_cycles(self, starting_vertices=None, rooted=False,
841841
sage: cycles_B = g.all_simple_cycles(weight_function=lambda e:e[0]+e[1], by_weight=True,
842842
....: report_weight=True, algorithm='B')
843843
sage: cycles_B
844-
[(2, [0, 1, 0]), (4, [0, 2, 0]), (6, [0, 1, 2, 0]), (6, [0, 2, 1, 0]),
845-
(6, [0, 3, 0]), (6, [1, 2, 1]), (8, [0, 1, 3, 0]), (8, [0, 3, 1, 0]),
846-
(8, [1, 3, 1]), (10, [0, 2, 3, 0]), (10, [0, 3, 2, 0]), (10, [2, 3, 2]),
847-
(12, [0, 1, 3, 2, 0]), (12, [0, 1, 2, 3, 0]), (12, [0, 2, 3, 1, 0]),
848-
(12, [0, 2, 1, 3, 0]), (12, [0, 3, 2, 1, 0]), (12, [0, 3, 1, 2, 0]),
849-
(12, [1, 2, 3, 1]), (12, [1, 3, 2, 1])]
844+
[(2.0, [0, 1, 0]), (4.0, [0, 2, 0]), (6.0, [0, 1, 2, 0]), (6.0, [0, 2, 1, 0]),
845+
(6.0, [0, 3, 0]), (6.0, [1, 2, 1]), (8.0, [0, 1, 3, 0]), (8.0, [0, 3, 1, 0]),
846+
(8.0, [1, 3, 1]), (10.0, [0, 2, 3, 0]), (10.0, [0, 3, 2, 0]), (10.0, [2, 3, 2]),
847+
(12.0, [0, 1, 3, 2, 0]), (12.0, [0, 1, 2, 3, 0]), (12.0, [0, 2, 3, 1, 0]),
848+
(12.0, [0, 2, 1, 3, 0]), (12.0, [0, 3, 2, 1, 0]), (12.0, [0, 3, 1, 2, 0]),
849+
(12.0, [1, 2, 3, 1]), (12.0, [1, 3, 2, 1])]
850850
sage: cycles.sort() == cycles_B.sort()
851851
True
852852

0 commit comments

Comments
 (0)