Skip to content

Commit db061a9

Browse files
author
Matthias Koeppe
committed
sage.graphs: Use even more block # needs
1 parent d7b2cb2 commit db061a9

File tree

12 files changed

+394
-346
lines changed

12 files changed

+394
-346
lines changed

src/sage/graphs/generators/random.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,19 @@ def RandomBarabasiAlbert(n, m, seed=None):
162162
163163
We view many random graphs using a graphics array::
164164
165+
sage: # needs networkx sage.plot
165166
sage: g = []
166167
sage: j = []
167-
sage: for i in range(1,10): # needs networkx
168+
sage: for i in range(1,10):
168169
....: k = graphs.RandomBarabasiAlbert(i+3, 3)
169170
....: g.append(k)
170-
sage: for i in range(3): # needs networkx sage.plot
171+
sage: for i in range(3):
171172
....: n = []
172173
....: for m in range(3):
173174
....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False))
174175
....: j.append(n)
175-
sage: G = graphics_array(j) # needs networkx sage.plot
176-
sage: G.show() # long time # needs networkx sage.plot
176+
sage: G = graphics_array(j)
177+
sage: G.show() # long time
177178
178179
When `m = 1`, the generated graph is a tree::
179180
@@ -690,18 +691,19 @@ def RandomGNM(n, m, dense=False, seed=None):
690691
691692
We view many random graphs using a graphics array::
692693
694+
sage: # needs networkx sage.plot
693695
sage: g = []
694696
sage: j = []
695-
sage: for i in range(9): # needs networkx
697+
sage: for i in range(9):
696698
....: k = graphs.RandomGNM(i+3, i^2-i)
697699
....: g.append(k)
698-
sage: for i in range(3): # needs networkx sage.plot
700+
sage: for i in range(3):
699701
....: n = []
700702
....: for m in range(3):
701703
....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False))
702704
....: j.append(n)
703-
sage: G = graphics_array(j) # needs networkx sage.plot
704-
sage: G.show() # long time # needs networkx sage.plot
705+
sage: G = graphics_array(j)
706+
sage: G.show() # long time
705707
"""
706708
if seed is None:
707709
seed = int(current_randstate().long_seed() % sys.maxsize)
@@ -1446,7 +1448,7 @@ def RandomTreePowerlaw(n, gamma=3, tries=1000, seed=None):
14461448
::
14471449
14481450
sage: G = graphs.RandomTreePowerlaw(15, 2) # needs networkx
1449-
sage: if G: # random output # long time # needs networkx sage.plot
1451+
sage: if G: # random output # long time, needs networkx sage.plot
14501452
....: G.show()
14511453
"""
14521454
if seed is None:
@@ -1486,7 +1488,7 @@ def RandomRegular(d, n, seed=None):
14861488
::
14871489
14881490
sage: G = graphs.RandomRegular(3, 20) # needs networkx
1489-
sage: if G: # random output # long time # needs networkx sage.plot
1491+
sage: if G: # random output # long time, needs networkx sage.plot
14901492
....: G.show()
14911493
14921494
REFERENCES:
@@ -2101,17 +2103,18 @@ def RandomBicubicPlanar(n, seed=None):
21012103
21022104
EXAMPLES::
21032105
2106+
sage: # needs sage.combinat
21042107
sage: n = randint(200, 300)
2105-
sage: G = graphs.RandomBicubicPlanar(n) # needs sage.combinat
2106-
sage: G.order() == 2*n # needs sage.combinat
2108+
sage: G = graphs.RandomBicubicPlanar(n)
2109+
sage: G.order() == 2*n
21072110
True
2108-
sage: G.size() == 3*n # needs sage.combinat
2111+
sage: G.size() == 3*n
21092112
True
2110-
sage: G.is_bipartite() and G.is_planar() and G.is_regular(3) # needs sage.combinat
2113+
sage: G.is_bipartite() and G.is_planar() and G.is_regular(3)
21112114
True
2112-
sage: dic = {'red': [v for v in G.vertices(sort=False) if v[0] == 'n'], # needs sage.combinat
2115+
sage: dic = {'red': [v for v in G.vertices(sort=False) if v[0] == 'n'],
21132116
....: 'blue': [v for v in G.vertices(sort=False) if v[0] != 'n']}
2114-
sage: G.plot(vertex_labels=False, vertex_size=20, vertex_colors=dic) # needs sage.combinat sage.plot
2117+
sage: G.plot(vertex_labels=False, vertex_size=20, vertex_colors=dic) # needs sage.plot
21152118
Graphics object consisting of ... graphics primitives
21162119
21172120
.. PLOT::
@@ -2213,17 +2216,18 @@ def RandomUnitDiskGraph(n, radius=.1, side=1, seed=None):
22132216
22142217
When using twice the same seed, the vertices get the same positions::
22152218
2219+
sage: # needs scipy
22162220
sage: from sage.misc.randstate import current_randstate
22172221
sage: seed = current_randstate().seed()
2218-
sage: G = graphs.RandomUnitDiskGraph(20, radius=.5, side=1, seed=seed) # needs scipy
2219-
sage: H = graphs.RandomUnitDiskGraph(20, radius=.2, side=1, seed=seed) # needs scipy
2220-
sage: H.is_subgraph(G, induced=False) # needs scipy
2222+
sage: G = graphs.RandomUnitDiskGraph(20, radius=.5, side=1, seed=seed)
2223+
sage: H = graphs.RandomUnitDiskGraph(20, radius=.2, side=1, seed=seed)
2224+
sage: H.is_subgraph(G, induced=False)
22212225
True
2222-
sage: H.size() <= G.size() # needs scipy
2226+
sage: H.size() <= G.size()
22232227
True
2224-
sage: Gpos = G.get_pos() # needs scipy
2225-
sage: Hpos = H.get_pos() # needs scipy
2226-
sage: all(Gpos[u] == Hpos[u] for u in G) # needs scipy
2228+
sage: Gpos = G.get_pos()
2229+
sage: Hpos = H.get_pos()
2230+
sage: all(Gpos[u] == Hpos[u] for u in G)
22272231
True
22282232
22292233
When the radius is more than `\sqrt{2 \text{side}}`, the graph is a clique::

src/sage/graphs/generators/smallgraphs.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ def HortonGraph():
21082108
96
21092109
sage: g.chromatic_number()
21102110
2
2111-
sage: g.is_hamiltonian() # not tested # needs sage.numerical.mip
2111+
sage: g.is_hamiltonian() # not tested (veeeery long) # needs sage.numerical.mip
21122112
False
21132113
"""
21142114
g = Graph(name="Horton Graph")
@@ -4540,11 +4540,7 @@ def TutteGraph():
45404540
4
45414541
sage: g.automorphism_group().cardinality() # needs sage.groups
45424542
3
4543-
<<<<<<< HEAD
4544-
sage: g.is_hamiltonian()
4545-
=======
45464543
sage: g.is_hamiltonian() # needs sage.numerical.mip
4547-
>>>>>>> 85d4a8d443 (./sage -fixdoctests --probe all --distribution 'sagemath-graphs[modules]' src/sage/graphs/generators/smallgraphs.py; ./sage -fixdoctests src/sage/graphs/generators/smallgraphs.py)
45484544
False
45494545
"""
45504546
g = Graph(name="Tutte Graph")
@@ -4723,11 +4719,7 @@ def _EllipticLinesProjectivePlaneScheme(k):
47234719
TESTS::
47244720
47254721
sage: from sage.graphs.generators.smallgraphs import _EllipticLinesProjectivePlaneScheme
4726-
<<<<<<< HEAD
4727-
sage: _EllipticLinesProjectivePlaneScheme(2)
4728-
=======
47294722
sage: _EllipticLinesProjectivePlaneScheme(2) # needs sage.libs.gap
4730-
>>>>>>> 85d4a8d443 (./sage -fixdoctests --probe all --distribution 'sagemath-graphs[modules]' src/sage/graphs/generators/smallgraphs.py; ./sage -fixdoctests src/sage/graphs/generators/smallgraphs.py)
47314723
[
47324724
[1 0 0 0 0 0] [0 1 1 1 1 0] [0 0 0 0 0 1]
47334725
[0 1 0 0 0 0] [1 0 1 1 0 1] [0 0 0 0 1 0]
@@ -5042,20 +5034,12 @@ def IoninKharaghani765Graph():
50425034
50435035
EXAMPLES::
50445036
5045-
<<<<<<< HEAD
5046-
sage: g = graphs.IoninKharaghani765Graph(); g
5047-
=======
50485037
sage: g = graphs.IoninKharaghani765Graph(); g # needs sage.modules sage.rings.finite_rings
5049-
>>>>>>> 85d4a8d443 (./sage -fixdoctests --probe all --distribution 'sagemath-graphs[modules]' src/sage/graphs/generators/smallgraphs.py; ./sage -fixdoctests src/sage/graphs/generators/smallgraphs.py)
50505038
Ionin-Kharaghani: Graph on 765 vertices
50515039
50525040
TESTS::
50535041
5054-
<<<<<<< HEAD
5055-
sage: graphs.strongly_regular_graph(765, 192, 48, 48)
5056-
=======
50575042
sage: graphs.strongly_regular_graph(765, 192, 48, 48) # needs sage.modules sage.rings.finite_rings
5058-
>>>>>>> 85d4a8d443 (./sage -fixdoctests --probe all --distribution 'sagemath-graphs[modules]' src/sage/graphs/generators/smallgraphs.py; ./sage -fixdoctests src/sage/graphs/generators/smallgraphs.py)
50595043
Ionin-Kharaghani: Graph on 765 vertices
50605044
50615045
.. TODO::

0 commit comments

Comments
 (0)