@@ -475,8 +475,7 @@ def lex_BFS(G, reverse=False, tree=False, initial_vertex=None, algorithm="fast")
475
475
edges = [(int_to_v[i], int_to_v[pred[i]]) for i in range (n) if pred[i] != i]
476
476
g = DiGraph([G, edges], format = ' vertices_and_edges' , sparse = True )
477
477
return sigma, g
478
- else :
479
- return sigma
478
+ return sigma
480
479
481
480
482
481
def lex_UP (G , reverse = False , tree = False , initial_vertex = None ):
@@ -597,8 +596,7 @@ def lex_UP(G, reverse=False, tree=False, initial_vertex=None):
597
596
from sage.graphs.digraph import DiGraph
598
597
g = DiGraph(sparse = True )
599
598
return [], g
600
- else :
601
- return []
599
+ return []
602
600
603
601
# Build adjacency list of G
604
602
cdef list int_to_v = list (G)
@@ -649,9 +647,7 @@ def lex_UP(G, reverse=False, tree=False, initial_vertex=None):
649
647
edges = [(int_to_v[i], int_to_v[pred[i]]) for i in range (nV) if pred[i] != - 1 ]
650
648
g.add_edges(edges)
651
649
return value, g
652
-
653
- else :
654
- return value
650
+ return value
655
651
656
652
657
653
def lex_DFS (G , reverse = False , tree = False , initial_vertex = None ):
@@ -771,8 +767,7 @@ def lex_DFS(G, reverse=False, tree=False, initial_vertex=None):
771
767
from sage.graphs.digraph import DiGraph
772
768
g = DiGraph(sparse = True )
773
769
return [], g
774
- else :
775
- return []
770
+ return []
776
771
777
772
# Build adjacency list of G
778
773
cdef list int_to_v = list (G)
@@ -824,9 +819,7 @@ def lex_DFS(G, reverse=False, tree=False, initial_vertex=None):
824
819
edges = [(int_to_v[i], int_to_v[pred[i]]) for i in range (nV) if pred[i] != - 1 ]
825
820
g.add_edges(edges)
826
821
return value, g
827
-
828
- else :
829
- return value
822
+ return value
830
823
831
824
832
825
def lex_DOWN (G , reverse = False , tree = False , initial_vertex = None ):
@@ -947,8 +940,7 @@ def lex_DOWN(G, reverse=False, tree=False, initial_vertex=None):
947
940
from sage.graphs.digraph import DiGraph
948
941
g = DiGraph(sparse = True )
949
942
return [], g
950
- else :
951
- return []
943
+ return []
952
944
953
945
# Build adjacency list of G
954
946
cdef list int_to_v = list (G)
@@ -1000,9 +992,7 @@ def lex_DOWN(G, reverse=False, tree=False, initial_vertex=None):
1000
992
edges = [(int_to_v[i], int_to_v[pred[i]]) for i in range (nV) if pred[i] != - 1 ]
1001
993
g.add_edges(edges)
1002
994
return value, g
1003
-
1004
- else :
1005
- return value
995
+ return value
1006
996
1007
997
1008
998
def lex_M (self , triangulation = False , labels = False , initial_vertex = None , algorithm = None ):
@@ -1151,10 +1141,9 @@ def lex_M(self, triangulation=False, labels=False, initial_vertex=None, algorith
1151
1141
1152
1142
if algorithm == " lex_M_slow" :
1153
1143
return lex_M_slow(self , triangulation = triangulation, labels = labels, initial_vertex = initial_vertex)
1154
- else :
1155
- if labels:
1156
- raise ValueError (" '{}' cannot return labels assigned to vertices" .format(algorithm))
1157
- return lex_M_fast(self , triangulation = triangulation, initial_vertex = initial_vertex)
1144
+ if labels:
1145
+ raise ValueError (" '{}' cannot return labels assigned to vertices" .format(algorithm))
1146
+ return lex_M_fast(self , triangulation = triangulation, initial_vertex = initial_vertex)
1158
1147
1159
1148
1160
1149
def lex_M_slow (G , triangulation = False , labels = False , initial_vertex = None ):
@@ -1317,8 +1306,7 @@ def lex_M_slow(G, triangulation=False, labels=False, initial_vertex=None):
1317
1306
return alpha, F
1318
1307
elif labels:
1319
1308
return alpha, label
1320
- else :
1321
- return alpha
1309
+ return alpha
1322
1310
1323
1311
1324
1312
def lex_M_fast (G , triangulation = False , initial_vertex = None ):
@@ -1522,8 +1510,7 @@ def lex_M_fast(G, triangulation=False, initial_vertex=None):
1522
1510
1523
1511
if triangulation:
1524
1512
return ordering, F
1525
- else :
1526
- return ordering
1513
+ return ordering
1527
1514
1528
1515
1529
1516
def is_valid_lex_M_order (G , alpha , F ):
0 commit comments