Skip to content

Commit 48b3d8d

Browse files
author
Matthias Koeppe
committed
sage.matroids: ./sage -fixdoctests --long --distribution 'sagemath-modules' --only-tags --probe=sage.rings.finite_rings --overwrite src/sage/matroids/*.py
1 parent 853d070 commit 48b3d8d

File tree

7 files changed

+198
-198
lines changed

7 files changed

+198
-198
lines changed

src/sage/matroids/catalog.py

Lines changed: 83 additions & 83 deletions
Large diffs are not rendered by default.

src/sage/matroids/constructor.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
A number of special matroids are collected under a ``named_matroids`` submenu.
5454
To see which, type ``matroids.named_matroids.<tab>`` as above::
5555
56-
sage: F7 = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
57-
sage: len(F7.nonspanning_circuits()) # optional - sage.rings.finite_rings
56+
sage: F7 = matroids.named_matroids.Fano()
57+
sage: len(F7.nonspanning_circuits())
5858
7
5959
6060
Constructing matroids
@@ -68,11 +68,11 @@
6868
6969
EXAMPLES::
7070
71-
sage: A = Matrix(GF(2), [[1, 0, 0, 0, 1, 1, 1], # optional - sage.rings.finite_rings
71+
sage: A = Matrix(GF(2), [[1, 0, 0, 0, 1, 1, 1],
7272
....: [0, 1, 0, 1, 0, 1, 1],
7373
....: [0, 0, 1, 1, 1, 0, 1]])
74-
sage: M = Matroid(A) # optional - sage.rings.finite_rings
75-
sage: M.is_isomorphic(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
74+
sage: M = Matroid(A)
75+
sage: M.is_isomorphic(matroids.named_matroids.Fano())
7676
True
7777
7878
sage: M = Matroid(graphs.PetersenGraph()) # optional - sage.graphs
@@ -148,8 +148,8 @@ def Matroid(groundset=None, data=None, **kwds):
148148
You will see a list of methods which will construct matroids. For
149149
example::
150150
151-
sage: F7 = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
152-
sage: len(F7.nonspanning_circuits()) # optional - sage.rings.finite_rings
151+
sage: F7 = matroids.named_matroids.Fano()
152+
sage: len(F7.nonspanning_circuits())
153153
7
154154
155155
or::
@@ -430,31 +430,31 @@ def Matroid(groundset=None, data=None, **kwds):
430430
The basic input is a
431431
:mod:`Sage matrix <sage.matrix.constructor>`::
432432
433-
sage: A = Matrix(GF(2), [[1, 0, 0, 1, 1, 0], # optional - sage.rings.finite_rings
433+
sage: A = Matrix(GF(2), [[1, 0, 0, 1, 1, 0],
434434
....: [0, 1, 0, 1, 0, 1],
435435
....: [0, 0, 1, 0, 1, 1]])
436-
sage: M = Matroid(matrix=A) # optional - sage.rings.finite_rings
436+
sage: M = Matroid(matrix=A)
437437
sage: M.is_isomorphic(matroids.CompleteGraphic(4)) # optional - sage.graphs sage.rings.finite_rings
438438
True
439439
440440
Various shortcuts are possible::
441441
442-
sage: M1 = Matroid(matrix=[[1, 0, 0, 1, 1, 0], # optional - sage.rings.finite_rings
442+
sage: M1 = Matroid(matrix=[[1, 0, 0, 1, 1, 0],
443443
....: [0, 1, 0, 1, 0, 1],
444444
....: [0, 0, 1, 0, 1, 1]], ring=GF(2))
445-
sage: M2 = Matroid(reduced_matrix=[[1, 1, 0], # optional - sage.rings.finite_rings
445+
sage: M2 = Matroid(reduced_matrix=[[1, 1, 0],
446446
....: [1, 0, 1],
447447
....: [0, 1, 1]], ring=GF(2))
448-
sage: M3 = Matroid(groundset=[0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
448+
sage: M3 = Matroid(groundset=[0, 1, 2, 3, 4, 5],
449449
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
450450
....: ring=GF(2))
451-
sage: A = Matrix(GF(2), [[1, 1, 0], [1, 0, 1], [0, 1, 1]]) # optional - sage.rings.finite_rings
452-
sage: M4 = Matroid([0, 1, 2, 3, 4, 5], A) # optional - sage.rings.finite_rings
453-
sage: M1 == M2 # optional - sage.rings.finite_rings
451+
sage: A = Matrix(GF(2), [[1, 1, 0], [1, 0, 1], [0, 1, 1]])
452+
sage: M4 = Matroid([0, 1, 2, 3, 4, 5], A)
453+
sage: M1 == M2
454454
True
455-
sage: M1 == M3 # optional - sage.rings.finite_rings
455+
sage: M1 == M3
456456
True
457-
sage: M1 == M4 # optional - sage.rings.finite_rings
457+
sage: M1 == M4
458458
True
459459
460460
However, with unnamed arguments the input has to be a ``Matrix``
@@ -469,21 +469,21 @@ def Matroid(groundset=None, data=None, **kwds):
469469
identity matrix is prepended. Otherwise the groundset size must equal
470470
the number of columns::
471471
472-
sage: A = Matrix(GF(2), [[1, 1, 0], [1, 0, 1], [0, 1, 1]]) # optional - sage.rings.finite_rings
473-
sage: M = Matroid([0, 1, 2], A) # optional - sage.rings.finite_rings
474-
sage: N = Matroid([0, 1, 2, 3, 4, 5], A) # optional - sage.rings.finite_rings
475-
sage: M.rank() # optional - sage.rings.finite_rings
472+
sage: A = Matrix(GF(2), [[1, 1, 0], [1, 0, 1], [0, 1, 1]])
473+
sage: M = Matroid([0, 1, 2], A)
474+
sage: N = Matroid([0, 1, 2, 3, 4, 5], A)
475+
sage: M.rank()
476476
2
477-
sage: N.rank() # optional - sage.rings.finite_rings
477+
sage: N.rank()
478478
3
479479
480480
We automatically create an optimized subclass, if available::
481481
482-
sage: Matroid([0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
482+
sage: Matroid([0, 1, 2, 3, 4, 5],
483483
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
484484
....: field=GF(2))
485485
Binary matroid of rank 3 on 6 elements, type (2, 7)
486-
sage: Matroid([0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
486+
sage: Matroid([0, 1, 2, 3, 4, 5],
487487
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
488488
....: field=GF(3))
489489
Ternary matroid of rank 3 on 6 elements, type 0-
@@ -498,7 +498,7 @@ def Matroid(groundset=None, data=None, **kwds):
498498
499499
Otherwise the generic LinearMatroid class is used::
500500
501-
sage: Matroid([0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
501+
sage: Matroid([0, 1, 2, 3, 4, 5],
502502
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
503503
....: field=GF(83))
504504
Linear matroid of rank 3 on 6 elements represented over the Finite
@@ -592,9 +592,9 @@ def Matroid(groundset=None, data=None, **kwds):
592592
593593
Most of the time, the matroid itself is returned::
594594
595-
sage: M = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
596-
sage: N = Matroid(M) # optional - sage.rings.finite_rings
597-
sage: N is M # optional - sage.rings.finite_rings
595+
sage: M = matroids.named_matroids.Fano()
596+
sage: N = Matroid(M)
597+
sage: N is M
598598
True
599599
600600
But it can be useful with the ``regular`` option::
@@ -626,7 +626,7 @@ def Matroid(groundset=None, data=None, **kwds):
626626
By default we check if the resulting matroid is actually regular. To
627627
increase speed, this check can be skipped::
628628
629-
sage: M = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
629+
sage: M = matroids.named_matroids.Fano()
630630
sage: N = Matroid(M, regular=True) # optional - sage.rings.finite_rings
631631
Traceback (most recent call last):
632632
...
@@ -640,12 +640,12 @@ def Matroid(groundset=None, data=None, **kwds):
640640
Sometimes the output is regular, but represents a different matroid
641641
from the one you intended::
642642
643-
sage: M = Matroid(Matrix(GF(3), [[1, 0, 1, 1], [0, 1, 1, 2]])) # optional - sage.rings.finite_rings
643+
sage: M = Matroid(Matrix(GF(3), [[1, 0, 1, 1], [0, 1, 1, 2]]))
644644
sage: N = Matroid(Matrix(GF(3), [[1, 0, 1, 1], [0, 1, 1, 2]]), # optional - sage.rings.finite_rings
645645
....: regular=True)
646-
sage: N.is_valid() # optional - sage.rings.finite_rings
646+
sage: N.is_valid()
647647
True
648-
sage: N.is_isomorphic(M) # optional - sage.rings.finite_rings
648+
sage: N.is_isomorphic(M)
649649
False
650650
651651
TESTS::

src/sage/matroids/dual_matroid.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
1111
EXAMPLES::
1212
13-
sage: M = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
14-
sage: N = M.dual() # optional - sage.rings.finite_rings
15-
sage: M.is_basis('abc') # optional - sage.rings.finite_rings
13+
sage: M = matroids.named_matroids.Fano()
14+
sage: N = M.dual()
15+
sage: M.is_basis('abc')
1616
True
17-
sage: N.is_basis('defg') # optional - sage.rings.finite_rings
17+
sage: N.is_basis('defg')
1818
True
19-
sage: M.dual().dual() == M # optional - sage.rings.finite_rings
19+
sage: M.dual().dual() == M
2020
True
2121
2222
Implementation
@@ -455,17 +455,17 @@ def __eq__(self, other):
455455
EXAMPLES::
456456
457457
sage: from sage.matroids.advanced import *
458-
sage: M1 = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
459-
sage: M2 = CircuitClosuresMatroid(M1.dual()) # optional - sage.rings.finite_rings
460-
sage: M3 = CircuitClosuresMatroid(M1).dual() # optional - sage.rings.finite_rings
458+
sage: M1 = matroids.named_matroids.Fano()
459+
sage: M2 = CircuitClosuresMatroid(M1.dual())
460+
sage: M3 = CircuitClosuresMatroid(M1).dual()
461461
sage: M4 = CircuitClosuresMatroid(groundset='abcdefg',
462462
....: circuit_closures={3: ['abcdefg'], 2: ['beg', 'cdb', 'cfg',
463463
....: 'ace', 'fed', 'gad', 'fab']}).dual()
464-
sage: M1.dual() == M2 # indirect doctest # optional - sage.rings.finite_rings
464+
sage: M1.dual() == M2
465465
False
466-
sage: M2 == M3 # optional - sage.rings.finite_rings
466+
sage: M2 == M3
467467
False
468-
sage: M3 == M4 # optional - sage.rings.finite_rings
468+
sage: M3 == M4
469469
True
470470
"""
471471
if not isinstance(other, DualMatroid):
@@ -487,17 +487,17 @@ def __ne__(self, other):
487487
EXAMPLES::
488488
489489
sage: from sage.matroids.advanced import *
490-
sage: M1 = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
491-
sage: M2 = CircuitClosuresMatroid(M1.dual()) # optional - sage.rings.finite_rings
492-
sage: M3 = CircuitClosuresMatroid(M1).dual() # optional - sage.rings.finite_rings
490+
sage: M1 = matroids.named_matroids.Fano()
491+
sage: M2 = CircuitClosuresMatroid(M1.dual())
492+
sage: M3 = CircuitClosuresMatroid(M1).dual()
493493
sage: M4 = CircuitClosuresMatroid(groundset='abcdefg',
494494
....: circuit_closures={3: ['abcdefg'], 2: ['beg', 'cdb', 'cfg',
495495
....: 'ace', 'fed', 'gad', 'fab']}).dual()
496-
sage: M1.dual() != M2 # indirect doctest # optional - sage.rings.finite_rings
496+
sage: M1.dual() != M2
497497
True
498-
sage: M2 != M3 # optional - sage.rings.finite_rings
498+
sage: M2 != M3
499499
True
500-
sage: M3 != M4 # optional - sage.rings.finite_rings
500+
sage: M3 != M4
501501
False
502502
"""
503503
return not self == other

src/sage/matroids/graphic_matroid.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
sage: edgelist = [(0, 1, 'a'), (0, 2, 'b'), (1, 2, 'c')]
4141
sage: G = Graph(edgelist)
4242
sage: M1 = Matroid(G)
43-
sage: M2 = Matroid(graph=edgelist)
43+
sage: M2 = Matroid(graph=edgelist) # optional - sage.graphs
4444
sage: M3 = Matroid(graphs.CycleGraph(3))
4545
sage: M1 == M3
4646
False
@@ -542,7 +542,7 @@ def _minor(self, contractions=frozenset([]), deletions=frozenset([])):
542542
543543
EXAMPLES::
544544
545-
sage: M = matroids.CompleteGraphic(5)
545+
sage: M = matroids.CompleteGraphic(5) # optional - sage.graphs
546546
sage: M._minor(deletions=frozenset([0,1,2]))
547547
Graphic matroid of rank 4 on 7 elements
548548
sage: M._minor(contractions=frozenset([0,1,2]))
@@ -599,7 +599,7 @@ def _has_minor(self, N, certificate=False):
599599
600600
::
601601
602-
sage: M = matroids.CompleteGraphic(6)
602+
sage: M = matroids.CompleteGraphic(6) # optional - sage.graphs
603603
sage: N = Matroid(range(8), graphs.WheelGraph(5))
604604
sage: M._has_minor(N)
605605
True
@@ -615,7 +615,7 @@ def _has_minor(self, N, certificate=False):
615615
If the matroids are not 3-connected, then the default matroid algorithms
616616
are used::
617617
618-
sage: M = matroids.CompleteGraphic(6)
618+
sage: M = matroids.CompleteGraphic(6) # optional - sage.graphs
619619
sage: N = Matroid(graphs.CycleGraph(4))
620620
sage: M.has_minor(N)
621621
True
@@ -1176,7 +1176,7 @@ def is_valid(self):
11761176
11771177
EXAMPLES::
11781178
1179-
sage: M = matroids.CompleteGraphic(4); M
1179+
sage: M = matroids.CompleteGraphic(4); M # optional - sage.graphs
11801180
M(K4): Graphic matroid of rank 3 on 6 elements
11811181
sage: M.is_valid()
11821182
True
@@ -1361,7 +1361,7 @@ def graphic_extension(self, u, v=None, element=None):
13611361
13621362
EXAMPLES::
13631363
1364-
sage: M = matroids.CompleteGraphic(4)
1364+
sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs
13651365
sage: M1 = M.graphic_extension(0,1,'a'); M1
13661366
Graphic matroid of rank 3 on 7 elements
13671367
sage: list(M1.graph().edge_iterator())
@@ -1931,7 +1931,7 @@ def one_sum(self, X, u, v):
19311931
19321932
TESTS::
19331933
1934-
sage: M = matroids.CompleteGraphic(4)
1934+
sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs
19351935
sage: M.one_sum(u=1, v=2, X=[0,1])
19361936
Traceback (most recent call last):
19371937
...
@@ -2013,7 +2013,7 @@ def regular_matroid(self):
20132013
20142014
EXAMPLES::
20152015
2016-
sage: M = matroids.CompleteGraphic(5); M
2016+
sage: M = matroids.CompleteGraphic(5); M # optional - sage.graphs
20172017
M(K5): Graphic matroid of rank 4 on 10 elements
20182018
sage: N = M.regular_matroid(); N
20192019
Regular matroid of rank 4 on 10 elements with 125 bases

0 commit comments

Comments
 (0)