Skip to content

Commit a07eb9e

Browse files
committed
some care in graph_coloring.pyx and hyperbolicity.pyx
1 parent 49e126f commit a07eb9e

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/sage/graphs/graph_coloring.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,7 @@ def vertex_coloring(g, k=None, value_only=False, hex_colors=False, solver=None,
555555
return 0
556556
elif hex_colors:
557557
return dict()
558-
else:
559-
return []
558+
return []
560559
# - Independent set
561560
if not g.size():
562561
if value_only:
@@ -1754,11 +1753,10 @@ def round_robin(n):
17541753
g.set_edge_label(n - 1, i, i)
17551754
for j in range(1, (n - 1) // 2 + 1):
17561755
g.set_edge_label(my_mod(i - j, n - 1), my_mod(i + j, n - 1), i)
1757-
return g
17581756
else:
17591757
g = round_robin(n + 1)
17601758
g.delete_vertex(n)
1761-
return g
1759+
return g
17621760

17631761

17641762
def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False,

src/sage/graphs/hyperbolicity.pyx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@ cdef tuple hyperbolicity_basic_algorithm(int N,
327327
# Last, we return the computed value and the certificate
328328
if h_LB != -1:
329329
return (h_LB, certificate)
330-
else:
331-
return (-1, [])
330+
return (-1, [])
332331

333332

334333
######################################################################
@@ -825,10 +824,10 @@ cdef tuple hyperbolicity_BCCM(int N,
825824
# Last, we return the computed value and the certificate
826825
if not certificate:
827826
return (-1, [], h_UB)
828-
else:
829-
# When using far-apart pairs, the loops may end before improving the
830-
# upper-bound
831-
return (h, certificate, h_UB)
827+
828+
# When using far-apart pairs, the loops may end before improving the
829+
# upper-bound
830+
return (h, certificate, h_UB)
832831

833832

834833
######################################################################
@@ -1043,10 +1042,10 @@ cdef tuple hyperbolicity_CCL(int N,
10431042
# Last, we return the computed value and the certificate
10441043
if not certificate:
10451044
return (-1, [], h_UB)
1046-
else:
1047-
# When using far-apart pairs, the loops may end before improving the
1048-
# upper-bound
1049-
return (h, certificate, h_UB if GOTO_RETURN else h)
1045+
1046+
# When using far-apart pairs, the loops may end before improving the
1047+
# upper-bound
1048+
return (h, certificate, h_UB if GOTO_RETURN else h)
10501049

10511050

10521051
def hyperbolicity(G,

0 commit comments

Comments
 (0)