@@ -18704,33 +18704,33 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black"
18704
18704
We consider the Cayley graph of the symmetric group, whose edges are
18705
18705
labelled by the numbers 1,2, and 3::
18706
18706
18707
- sage: G = SymmetricGroup(4).cayley_graph()
18708
- sage: set(G.edge_labels())
18707
+ sage: G = SymmetricGroup(4).cayley_graph() # optional - sage.groups
18708
+ sage: set(G.edge_labels()) # optional - sage.groups
18709
18709
{1, 2, 3}
18710
18710
18711
18711
We first request the coloring as a function::
18712
18712
18713
- sage: f = G._color_by_label(as_function=True)
18714
- sage: [f(1), f(2), f(3)]
18713
+ sage: f = G._color_by_label(as_function=True) # optional - sage.groups
18714
+ sage: [f(1), f(2), f(3)] # optional - sage.groups
18715
18715
['#0000ff', '#ff0000', '#00ff00']
18716
- sage: f = G._color_by_label({1: "blue", 2: "red", 3: "green"}, as_function=True)
18717
- sage: [f(1), f(2), f(3)]
18716
+ sage: f = G._color_by_label({1: "blue", 2: "red", 3: "green"}, as_function=True) # optional - sage.groups
18717
+ sage: [f(1), f(2), f(3)] # optional - sage.groups
18718
18718
['blue', 'red', 'green']
18719
- sage: f = G._color_by_label({1: "red"}, as_function=True)
18720
- sage: [f(1), f(2), f(3)]
18719
+ sage: f = G._color_by_label({1: "red"}, as_function=True) # optional - sage.groups
18720
+ sage: [f(1), f(2), f(3)] # optional - sage.groups
18721
18721
['red', 'black', 'black']
18722
- sage: f = G._color_by_label({1: "red"}, as_function=True, default_color='blue')
18723
- sage: [f(1), f(2), f(3)]
18722
+ sage: f = G._color_by_label({1: "red"}, as_function=True, default_color='blue') # optional - sage.groups
18723
+ sage: [f(1), f(2), f(3)] # optional - sage.groups
18724
18724
['red', 'blue', 'blue']
18725
18725
18726
18726
The default output is a dictionary assigning edges to colors::
18727
18727
18728
- sage: G._color_by_label()
18728
+ sage: G._color_by_label() # optional - sage.groups
18729
18729
{'#0000ff': [((), (1,2), 1), ...],
18730
18730
'#00ff00': [((), (3,4), 3), ...],
18731
18731
'#ff0000': [((), (2,3), 2), ...]}
18732
18732
18733
- sage: G._color_by_label({1: "blue", 2: "red", 3: "green"})
18733
+ sage: G._color_by_label({1: "blue", 2: "red", 3: "green"}) # optional - sage.groups
18734
18734
{'blue': [((), (1,2), 1), ...],
18735
18735
'green': [((), (3,4), 3), ...],
18736
18736
'red': [((), (2,3), 2), ...]}
@@ -18739,12 +18739,12 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black"
18739
18739
18740
18740
We check what happens when several labels have the same color::
18741
18741
18742
- sage: result = G._color_by_label({1: "blue", 2: "blue", 3: "green"})
18743
- sage: sorted(result)
18742
+ sage: result = G._color_by_label({1: "blue", 2: "blue", 3: "green"}) # optional - sage.groups
18743
+ sage: sorted(result) # optional - sage.groups
18744
18744
['blue', 'green']
18745
- sage: len(result['blue'])
18745
+ sage: len(result['blue']) # optional - sage.groups
18746
18746
48
18747
- sage: len(result['green'])
18747
+ sage: len(result['green']) # optional - sage.groups
18748
18748
24
18749
18749
"""
18750
18750
if format is True:
@@ -21636,10 +21636,10 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input=True, c
21636
21636
Relabeling using a Sage permutation::
21637
21637
21638
21638
sage: G = graphs.PathGraph(3)
21639
- sage: from sage.groups.perm_gps.permgroup_named import SymmetricGroup
21640
- sage: S = SymmetricGroup(3)
21641
- sage: gamma = S('(1,2)')
21642
- sage: G.relabel(gamma, inplace=False).am()
21639
+ sage: from sage.groups.perm_gps.permgroup_named import SymmetricGroup # optional - sage.groups
21640
+ sage: S = SymmetricGroup(3) # optional - sage.groups
21641
+ sage: gamma = S('(1,2)') # optional - sage.groups
21642
+ sage: G.relabel(gamma, inplace=False).am() # optional - sage.groups
21643
21643
[0 0 1]
21644
21644
[0 0 1]
21645
21645
[1 1 0]
0 commit comments