diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 2ccf5daa6dc..01979c1de33 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -17087,9 +17087,10 @@ def lex_BFS(self, reverse=False, tree=False, initial_vertex=None): For a Chordal Graph, a reversed Lex BFS is a Perfect Elimination Order:: sage: g = graphs.PathGraph(3).lexicographic_product(graphs.CompleteGraph(2)) - sage: g.lex_BFS(reverse=True) + sage: g.lex_BFS(reverse=True) # py2 [(2, 0), (2, 1), (1, 1), (1, 0), (0, 0), (0, 1)] - + sage: g.lex_BFS(reverse=True) # py3 + [(2, 1), (2, 0), (1, 1), (1, 0), (0, 1), (0, 0)] And the vertices at the end of the tree of discovery are, for chordal graphs, simplicial vertices (their neighborhood is a complete graph):: @@ -18205,8 +18206,10 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black" We first request the coloring as a function:: sage: f = G._color_by_label(as_function=True) - sage: [f(1), f(2), f(3)] + sage: [f(1), f(2), f(3)] # py2 ['#ff0000', '#0000ff', '#00ff00'] + sage: [f(1), f(2), f(3)] # py3 + ['#0000ff', '#ff0000', '#00ff00'] sage: f = G._color_by_label({1: "blue", 2: "red", 3: "green"}, as_function=True) sage: [f(1), f(2), f(3)] ['blue', 'red', 'green'] @@ -18219,15 +18222,23 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black" The default output is a dictionary assigning edges to colors:: - sage: G._color_by_label() + sage: G._color_by_label() # py2 {'#0000ff': [((1,3,2,4), (1,2,4), 2), ...], '#00ff00': [((1,3,2,4), (1,4)(2,3), 3), ...], '#ff0000': [((1,3,2,4), (1,3)(2,4), 1), ...]} + sage: G._color_by_label() # py3 + {'#0000ff': [((), (1,2), 1), ...], + '#00ff00': [((), (3,4), 3), ...], + '#ff0000': [((), (2,3), 2), ...]} - sage: G._color_by_label({1: "blue", 2: "red", 3: "green"}) + sage: G._color_by_label({1: "blue", 2: "red", 3: "green"}) # py2 {'blue': [((1,3,2,4), (1,3)(2,4), 1), ...], 'green': [((1,3,2,4), (1,4)(2,3), 3), ...], 'red': [((1,3,2,4), (1,2,4), 2), ...]} + sage: G._color_by_label({1: "blue", 2: "red", 3: "green"}) # py3 + {'blue': [((), (1,2), 1), ...], + 'green': [((), (3,4), 3), ...], + 'red': [((), (2,3), 2), ...]} TESTS: @@ -18577,10 +18588,15 @@ def layout_extend_randomly(self, pos, dim=2): EXAMPLES:: sage: H = digraphs.ButterflyGraph(1) - sage: H.layout_extend_randomly({('0', 0): (0, 0), ('1', 1): (1, 1)}) + sage: H.layout_extend_randomly({('0', 0): (0, 0), ('1', 1): (1, 1)}) # py2 {('0', 0): (0, 0), ('0', 1): [0.0446..., 0.332...], - ('1', 0): [0.111..., 0.514...], + ('1', 0): [0.1114..., 0.514...], + ('1', 1): (1, 1)} + sage: H.layout_extend_randomly({('0', 0): (0, 0), ('1', 1): (1, 1)}) # py3 + {('0', 0): (0, 0), + ('0', 1): [0.1114..., 0.514...], + ('1', 0): [0.0446..., 0.332...], ('1', 1): (1, 1)} """ assert dim == 2 # 3d not yet implemented