Skip to content

Commit 6fc6fc1

Browse files
dcoudertdimpase
authored andcommitted
PR #35956: fix doctests
1 parent 3e16dbf commit 6fc6fc1

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/sage/graphs/generic_graph_pyx.pyx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,28 +1250,17 @@ cpdef tuple find_hamiltonian(G, long max_iter=100000, long reset_bound=30000,
12501250
12511251
The method can also be used for directed graphs::
12521252
1253-
sage: G = DiGraph()
1254-
sage: G.add_path('abcd')
1255-
sage: G.add_path('xyd')
1253+
sage: G = DiGraph([(0, 1), (1, 2), (2, 3)])
12561254
sage: fh(G)
1257-
(False, ['a', 'b', 'c', 'd'])
1255+
(False, [0, 1, 2, 3])
12581256
sage: G = G.reverse()
12591257
sage: fh(G)
1260-
(False, ['d', 'c', 'b', 'a'])
1261-
sage: H = DiGraph()
1262-
sage: H.add_cycle('abcdefgh')
1263-
sage: H.add_edge('dg')
1264-
sage: b, C = fh(H)
1265-
sage: b, len(C)
1266-
(True, 8)
1267-
sage: H.delete_edge('ab')
1268-
sage: fh(H, find_path=False)
1269-
(False, ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'a'])
1270-
sage: fh(H, find_path=True)
1271-
(True, ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'a'])
1272-
sage: H.delete_edge('gh')
1273-
sage: fh(H, find_path=True)
1274-
(False, ['b', 'c', 'd', 'e', 'f', 'g'])
1258+
(False, [3, 2, 1, 0])
1259+
sage: G = DiGraph()
1260+
sage: G.add_cycle([0, 1, 2, 3, 4, 5])
1261+
sage: b, P = fh(G)
1262+
sage: b, len(P)
1263+
(True, 6)
12751264
12761265
TESTS:
12771266

0 commit comments

Comments
 (0)