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