Skip to content

Commit 0d94e55

Browse files
author
Matthias Koeppe
committed
./sage -fixdoctests --only-tags src/sage/graphs
1 parent cd752ff commit 0d94e55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1980
-1871
lines changed

src/sage/graphs/base/boost_graph.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'):
572572
from sage.graphs.base.boost_graph import bandwidth_heuristics
573573
sage: bandwidth_heuristics(Graph())
574574
(0, [])
575-
sage: bandwidth_heuristics(graphs.RandomGNM(10,0)) # optional - networkx
575+
sage: bandwidth_heuristics(graphs.RandomGNM(10,0)) # needs networkx
576576
(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
577577
578578
"""
@@ -1964,8 +1964,8 @@ cpdef diameter_DHV(g, weight_function=None, check_weight=True):
19641964
19651965
TESTS::
19661966
1967-
sage: G = graphs.RandomBarabasiAlbert(17,6) # optional - networkx
1968-
sage: diameter_DHV(G) == G.diameter(algorithm = 'Dijkstra_Boost') # optional - networkx
1967+
sage: G = graphs.RandomBarabasiAlbert(17,6) # needs networkx
1968+
sage: diameter_DHV(G) == G.diameter(algorithm = 'Dijkstra_Boost') # needs networkx
19691969
True
19701970
sage: G = Graph([(0,1,-1)], weighted=True)
19711971
sage: diameter_DHV(G)

src/sage/graphs/base/c_graph.pyx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,11 +1577,11 @@ cdef class CGraphBackend(GenericGraphBackend):
15771577
We check that the bug described in :trac:`8406` is gone::
15781578
15791579
sage: G = Graph()
1580-
sage: R.<a> = GF(3**3) # optional - sage.rings.finite_rings
1581-
sage: S.<x> = R[] # optional - sage.rings.finite_rings
1582-
sage: G.add_vertex(a**2) # optional - sage.rings.finite_rings
1583-
sage: G.add_vertex(x) # optional - sage.rings.finite_rings
1584-
sage: G.vertices(sort=True) # optional - sage.rings.finite_rings
1580+
sage: R.<a> = GF(3**3) # needs sage.rings.finite_rings
1581+
sage: S.<x> = R[] # needs sage.rings.finite_rings
1582+
sage: G.add_vertex(a**2) # needs sage.rings.finite_rings
1583+
sage: G.add_vertex(x) # needs sage.rings.finite_rings
1584+
sage: G.vertices(sort=True) # needs sage.rings.finite_rings
15851585
[a^2, x]
15861586
15871587
And that the bug described in :trac:`9610` is gone::
@@ -2107,9 +2107,9 @@ cdef class CGraphBackend(GenericGraphBackend):
21072107
21082108
Ensure that :trac:`13664` is fixed ::
21092109
2110-
sage: W = WeylGroup(["A",1]) # optional - sage.combinat sage.groups
2111-
sage: G = W.cayley_graph() # optional - sage.combinat sage.groups
2112-
sage: Graph(G).degree() # optional - sage.combinat sage.groups
2110+
sage: W = WeylGroup(["A",1]) # needs sage.combinat sage.groups
2111+
sage: G = W.cayley_graph() # needs sage.combinat sage.groups
2112+
sage: Graph(G).degree() # needs sage.combinat sage.groups
21132113
[1, 1]
21142114
sage: h = Graph()
21152115
sage: h.add_edge(1,2,"a")
@@ -4406,9 +4406,9 @@ cdef class CGraphBackend(GenericGraphBackend):
44064406
44074407
TESTS::
44084408
4409-
sage: P = posets.PentagonPoset() # optional - sage.modules
4410-
sage: H = P._hasse_diagram # optional - sage.modules
4411-
sage: H._backend.is_connected() # optional - sage.modules
4409+
sage: P = posets.PentagonPoset() # needs sage.modules
4410+
sage: H = P._hasse_diagram # needs sage.modules
4411+
sage: H._backend.is_connected() # needs sage.modules
44124412
True
44134413
"""
44144414
cdef int v_int
@@ -4548,7 +4548,7 @@ cdef class CGraphBackend(GenericGraphBackend):
45484548
At first, the following graph is acyclic::
45494549
45504550
sage: D = DiGraph({ 0:[1,2,3], 4:[2,5], 1:[8], 2:[7], 3:[7], 5:[6,7], 7:[8], 6:[9], 8:[10], 9:[10] })
4551-
sage: D.plot(layout='circular').show() # optional - sage.plot
4551+
sage: D.plot(layout='circular').show() # needs sage.plot
45524552
sage: D.is_directed_acyclic()
45534553
True
45544554
@@ -4589,9 +4589,9 @@ cdef class CGraphBackend(GenericGraphBackend):
45894589
45904590
TESTS::
45914591
4592-
sage: m = Matrix(3,[0, 1, 1, 0, 0, 0, 0, 1, 0]) # optional - sage.modules
4593-
sage: g = DiGraph(m) # optional - sage.modules
4594-
sage: g.is_directed_acyclic(certificate=True) # optional - sage.modules
4592+
sage: m = Matrix(3,[0, 1, 1, 0, 0, 0, 0, 1, 0]) # needs sage.modules
4593+
sage: g = DiGraph(m) # needs sage.modules
4594+
sage: g.is_directed_acyclic(certificate=True) # needs sage.modules
45954595
(True, [0, 2, 1])
45964596
"""
45974597
if not self._directed:

src/sage/graphs/base/static_sparse_backend.pyx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,17 +446,18 @@ cdef class StaticSparseBackend(CGraphBackend):
446446
447447
::
448448
449-
sage: g = DiGraph(digraphs.DeBruijn(4, 3), data_structure="static_sparse") # optional - sage.combinat
450-
sage: gi = DiGraph(g, data_structure="static_sparse") # optional - sage.combinat
451-
sage: gi.edges(sort=True)[0] # optional - sage.combinat
449+
sage: # needs sage.combinat
450+
sage: g = DiGraph(digraphs.DeBruijn(4, 3), data_structure="static_sparse")
451+
sage: gi = DiGraph(g, data_structure="static_sparse")
452+
sage: gi.edges(sort=True)[0]
452453
('000', '000', '0')
453-
sage: sorted(gi.edges_incident('111')) # optional - sage.combinat
454+
sage: sorted(gi.edges_incident('111'))
454455
[('111', '110', '0'),
455456
('111', '111', '1'),
456457
('111', '112', '2'),
457458
('111', '113', '3')]
458459
459-
sage: set(g.edges(sort=False)) == set(gi.edges(sort=False)) # optional - sage.combinat
460+
sage: set(g.edges(sort=False)) == set(gi.edges(sort=False)) # needs sage.combinat
460461
True
461462
462463
::
@@ -671,10 +672,10 @@ cdef class StaticSparseBackend(CGraphBackend):
671672
::
672673
673674
sage: from sage.graphs.base.static_sparse_backend import StaticSparseBackend
674-
sage: g = StaticSparseBackend(digraphs.DeBruijn(3, 2)) # optional - sage.combinat
675-
sage: g.has_edge('00', '01', '1') # optional - sage.combinat
675+
sage: g = StaticSparseBackend(digraphs.DeBruijn(3, 2)) # needs sage.combinat
676+
sage: g.has_edge('00', '01', '1') # needs sage.combinat
676677
True
677-
sage: g.has_edge('00', '01', '0') # optional - sage.combinat
678+
sage: g.has_edge('00', '01', '0') # needs sage.combinat
678679
False
679680
"""
680681
try:

src/sage/graphs/base/static_sparse_graph.pyx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ def tarjan_strongly_connected_components(G):
731731
732732
Checking against NetworkX::
733733
734-
sage: import networkx # optional - networkx
735-
sage: for i in range(10): # long time # optional - networkx
734+
sage: import networkx # needs networkx
735+
sage: for i in range(10): # long time # needs networkx
736736
....: g = digraphs.RandomDirectedGNP(100,.05)
737737
....: h = g.networkx_graph()
738738
....: scc1 = g.strongly_connected_components()
@@ -1023,8 +1023,8 @@ def spectral_radius(G, prec=1e-10):
10231023
10241024
sage: G = Graph([(0,1),(0,2),(1,2),(1,3),(2,4),(3,4)])
10251025
sage: e_min, e_max = spectral_radius(G, 1e-14)
1026-
sage: e = max(G.adjacency_matrix().charpoly().roots(AA, multiplicities=False))
1027-
sage: e_min < e < e_max
1026+
sage: e = max(G.adjacency_matrix().charpoly().roots(AA, multiplicities=False)) # needs sage.modules
1027+
sage: e_min < e < e_max # needs sage.modules
10281028
True
10291029
10301030
sage: G.spectral_radius() # abs tol 1e-9
@@ -1037,10 +1037,10 @@ def spectral_radius(G, prec=1e-10):
10371037
sage: G.add_edge(200,0)
10381038
sage: G.add_edge(1,0)
10391039
sage: e_min, e_max = spectral_radius(G, 0.00001)
1040-
sage: p = G.adjacency_matrix(sparse=True).charpoly()
1041-
sage: p
1040+
sage: p = G.adjacency_matrix(sparse=True).charpoly() # needs sage.modules
1041+
sage: p # needs sage.modules
10421042
x^201 - x^199 - 1
1043-
sage: r = p.roots(AA, multiplicities=False)[0]
1043+
sage: r = p.roots(AA, multiplicities=False)[0] # needs sage.modules
10441044
sage: e_min < r < e_max
10451045
True
10461046
@@ -1060,7 +1060,7 @@ def spectral_radius(G, prec=1e-10):
10601060
sage: G.add_edges([(0,0),(0,0),(0,1),(1,0)])
10611061
sage: spectral_radius(G, 1e-14) # abs tol 1e-14
10621062
(2.414213562373094, 2.414213562373095)
1063-
sage: max(G.adjacency_matrix().eigenvalues(AA))
1063+
sage: max(G.adjacency_matrix().eigenvalues(AA)) # needs sage.modules
10641064
2.414213562373095?
10651065
10661066
Some bipartite graphs::
@@ -1091,7 +1091,7 @@ def spectral_radius(G, prec=1e-10):
10911091
...
10921092
ValueError: precision (=1.00000000000000e-20) is too small
10931093
1094-
sage: for _ in range(100):
1094+
sage: for _ in range(100): # needs sage.modules
10951095
....: G = digraphs.RandomDirectedGNM(10,35)
10961096
....: if not G.is_strongly_connected():
10971097
....: continue

0 commit comments

Comments
 (0)