Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 678ffc8

Browse files
author
Matthias Koeppe
committed
src/sage/graphs: Mark some doctests # optional - sage.groups
1 parent 9123f4a commit 678ffc8

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/sage/graphs/generators/families.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2790,8 +2790,8 @@ def HanoiTowerGraph(pegs, disks, labels=True, positions=True):
27902790
27912791
::
27922792
2793-
sage: H = graphs.HanoiTowerGraph(3,4,labels=False,positions=False)
2794-
sage: H.automorphism_group().is_isomorphic(SymmetricGroup(3))
2793+
sage: H = graphs.HanoiTowerGraph(3, 4, labels=False, positions=False)
2794+
sage: H.automorphism_group().is_isomorphic(SymmetricGroup(3)) # optional - sage.groups
27952795
True
27962796
sage: H.chromatic_number()
27972797
3

src/sage/graphs/generic_graph.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -18704,33 +18704,33 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black"
1870418704
We consider the Cayley graph of the symmetric group, whose edges are
1870518705
labelled by the numbers 1,2, and 3::
1870618706

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
1870918709
{1, 2, 3}
1871018710

1871118711
We first request the coloring as a function::
1871218712

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
1871518715
['#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
1871818718
['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
1872118721
['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
1872418724
['red', 'blue', 'blue']
1872518725

1872618726
The default output is a dictionary assigning edges to colors::
1872718727

18728-
sage: G._color_by_label()
18728+
sage: G._color_by_label() # optional - sage.groups
1872918729
{'#0000ff': [((), (1,2), 1), ...],
1873018730
'#00ff00': [((), (3,4), 3), ...],
1873118731
'#ff0000': [((), (2,3), 2), ...]}
1873218732

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
1873418734
{'blue': [((), (1,2), 1), ...],
1873518735
'green': [((), (3,4), 3), ...],
1873618736
'red': [((), (2,3), 2), ...]}
@@ -18739,12 +18739,12 @@ def _color_by_label(self, format='hex', as_function=False, default_color="black"
1873918739

1874018740
We check what happens when several labels have the same color::
1874118741

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
1874418744
['blue', 'green']
18745-
sage: len(result['blue'])
18745+
sage: len(result['blue']) # optional - sage.groups
1874618746
48
18747-
sage: len(result['green'])
18747+
sage: len(result['green']) # optional - sage.groups
1874818748
24
1874918749
"""
1875018750
if format is True:
@@ -21636,10 +21636,10 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input=True, c
2163621636
Relabeling using a Sage permutation::
2163721637

2163821638
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
2164321643
[0 0 1]
2164421644
[0 0 1]
2164521645
[1 1 0]

src/sage/graphs/graph.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@ class Graph(GenericGraph):
601601
'out' is the label for the edge on 2 and 5. Labels can be used as
602602
weights, if all the labels share some common parent.::
603603
604-
sage: a,b,c,d,e,f = sorted(SymmetricGroup(3))
605-
sage: Graph({b:{d:'c',e:'p'}, c:{d:'p',e:'c'}})
604+
sage: a, b, c, d, e, f = sorted(SymmetricGroup(3)) # optional - sage.groups
605+
sage: Graph({b: {d: 'c', e: 'p'}, c: {d: 'p', e: 'c'}}) # optional - sage.groups
606606
Graph on 4 vertices
607607
608608
#. A dictionary of lists::

0 commit comments

Comments
 (0)