diff -up src/sage/graphs/graph_decompositions/cutwidth.pyx.orig src/sage/graphs/graph_decompositions/cutwidth.pyx --- src/sage/graphs/graph_decompositions/cutwidth.pyx.orig 2022-01-30 06:41:50.000000000 -0700 +++ src/sage/graphs/graph_decompositions/cutwidth.pyx 2022-03-06 17:04:36.234711622 -0700 @@ -522,12 +522,12 @@ def cutwidth_dyn(G, lower_bound=0): if exists(g, neighborhoods, 0, 0, i, k) <= k: order = find_order(g, neighborhoods, k) return k, [g.int_to_vertices[i] for i in order] + + order = find_order(g, neighborhoods, k) + return k, [g.int_to_vertices[i] for i in order] finally: sig_free(neighborhoods) - order = find_order(g, neighborhoods, k) - return k, [g.int_to_vertices[i] for i in order] - cdef inline int exists(FastDigraph g, uint8_t* neighborhoods, int S, int cost_S, int v, int k): r""" Check whether an ordering with the given cost `k` exists, and updates data