53
53
A number of special matroids are collected under a ``named_matroids`` submenu.
54
54
To see which, type ``matroids.named_matroids.<tab>`` as above::
55
55
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())
58
58
7
59
59
60
60
Constructing matroids
68
68
69
69
EXAMPLES::
70
70
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],
72
72
....: [0, 1, 0, 1, 0, 1, 1],
73
73
....: [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())
76
76
True
77
77
78
78
sage: M = Matroid(graphs.PetersenGraph()) # optional - sage.graphs
@@ -148,8 +148,8 @@ def Matroid(groundset=None, data=None, **kwds):
148
148
You will see a list of methods which will construct matroids. For
149
149
example::
150
150
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())
153
153
7
154
154
155
155
or::
@@ -430,31 +430,31 @@ def Matroid(groundset=None, data=None, **kwds):
430
430
The basic input is a
431
431
:mod:`Sage matrix <sage.matrix.constructor>`::
432
432
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],
434
434
....: [0, 1, 0, 1, 0, 1],
435
435
....: [0, 0, 1, 0, 1, 1]])
436
- sage: M = Matroid(matrix=A) # optional - sage.rings.finite_rings
436
+ sage: M = Matroid(matrix=A)
437
437
sage: M.is_isomorphic(matroids.CompleteGraphic(4)) # optional - sage.graphs sage.rings.finite_rings
438
438
True
439
439
440
440
Various shortcuts are possible::
441
441
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],
443
443
....: [0, 1, 0, 1, 0, 1],
444
444
....: [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],
446
446
....: [1, 0, 1],
447
447
....: [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],
449
449
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
450
450
....: 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
454
454
True
455
- sage: M1 == M3 # optional - sage.rings.finite_rings
455
+ sage: M1 == M3
456
456
True
457
- sage: M1 == M4 # optional - sage.rings.finite_rings
457
+ sage: M1 == M4
458
458
True
459
459
460
460
However, with unnamed arguments the input has to be a ``Matrix``
@@ -469,21 +469,21 @@ def Matroid(groundset=None, data=None, **kwds):
469
469
identity matrix is prepended. Otherwise the groundset size must equal
470
470
the number of columns::
471
471
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()
476
476
2
477
- sage: N.rank() # optional - sage.rings.finite_rings
477
+ sage: N.rank()
478
478
3
479
479
480
480
We automatically create an optimized subclass, if available::
481
481
482
- sage: Matroid([0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
482
+ sage: Matroid([0, 1, 2, 3, 4, 5],
483
483
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
484
484
....: field=GF(2))
485
485
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],
487
487
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
488
488
....: field=GF(3))
489
489
Ternary matroid of rank 3 on 6 elements, type 0-
@@ -498,7 +498,7 @@ def Matroid(groundset=None, data=None, **kwds):
498
498
499
499
Otherwise the generic LinearMatroid class is used::
500
500
501
- sage: Matroid([0, 1, 2, 3, 4, 5], # optional - sage.rings.finite_rings
501
+ sage: Matroid([0, 1, 2, 3, 4, 5],
502
502
....: matrix=[[1, 1, 0], [1, 0, 1], [0, 1, 1]],
503
503
....: field=GF(83))
504
504
Linear matroid of rank 3 on 6 elements represented over the Finite
@@ -592,9 +592,9 @@ def Matroid(groundset=None, data=None, **kwds):
592
592
593
593
Most of the time, the matroid itself is returned::
594
594
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
598
598
True
599
599
600
600
But it can be useful with the ``regular`` option::
@@ -626,7 +626,7 @@ def Matroid(groundset=None, data=None, **kwds):
626
626
By default we check if the resulting matroid is actually regular. To
627
627
increase speed, this check can be skipped::
628
628
629
- sage: M = matroids.named_matroids.Fano() # optional - sage.rings.finite_rings
629
+ sage: M = matroids.named_matroids.Fano()
630
630
sage: N = Matroid(M, regular=True) # optional - sage.rings.finite_rings
631
631
Traceback (most recent call last):
632
632
...
@@ -640,12 +640,12 @@ def Matroid(groundset=None, data=None, **kwds):
640
640
Sometimes the output is regular, but represents a different matroid
641
641
from the one you intended::
642
642
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]]))
644
644
sage: N = Matroid(Matrix(GF(3), [[1, 0, 1, 1], [0, 1, 1, 2]]), # optional - sage.rings.finite_rings
645
645
....: regular=True)
646
- sage: N.is_valid() # optional - sage.rings.finite_rings
646
+ sage: N.is_valid()
647
647
True
648
- sage: N.is_isomorphic(M) # optional - sage.rings.finite_rings
648
+ sage: N.is_isomorphic(M)
649
649
False
650
650
651
651
TESTS::
0 commit comments