@@ -4931,7 +4931,7 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
4931
4931
:meth:`MixedIntegerLinearProgram.get_values`.
4932
4932
4933
4933
- ``induced`` -- boolean (default: ``False``); if ``True``, returns an
4934
- induced minor isomorphic to `H` if it exists, and ``ValueError`` otherwise.
4934
+ induced minor isomorphic to `H` if it exists, and ``:class:` ValueError` `` otherwise.
4935
4935
4936
4936
OUTPUT:
4937
4937
@@ -5004,20 +5004,15 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
5004
5004
True
5005
5005
5006
5006
TESTS::
5007
-
5007
+
5008
+ sage: # a graph `g` may have minor but no induced minor isomorphic to given graph `h`
5008
5009
sage: g = Graph([(0, 1), (0, 2), (1, 2), (2, 3), (3, 4), (3, 5), (4, 5), (6, 5)])
5009
5010
sage: h = Graph([(9, 10), (9, 11), (9, 12), (9, 13)])
5011
+ sage: l = g.minor(h, induced=False)
5010
5012
sage: l = g.minor(h, induced=True)
5011
5013
Traceback (most recent call last):
5012
5014
...
5013
5015
ValueError: This graph has no induced minor isomorphic to H !
5014
-
5015
- sage: # induced minor does not exist, but minor does
5016
- sage: g = Graph([(0, 1), (0, 2), (1, 2), (2, 3), (3, 4), (3, 5), (4, 5), (6, 5)])
5017
- sage: h = Graph([(9, 10), (9, 11), (9, 12), (9, 13)])
5018
- sage: l = g.minor(h, induced=False)
5019
- sage: print("minor exists")
5020
- minor exists
5021
5016
5022
5017
sage: g = Graph([(0, 1), (0, 2), (1, 2), (2, 3), (3, 4), (3, 5), (4, 5), (6, 5)])
5023
5018
sage: h = Graph([(7, 8), (8, 9), (9, 10), (10, 11)])
@@ -5106,7 +5101,10 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
5106
5101
try :
5107
5102
p .solve (log = verbose )
5108
5103
except MIPSolverException :
5109
- raise ValueError ("This graph has no minor isomorphic to H !" )
5104
+ if induced :
5105
+ raise ValueError ("This graph has no induced minor isomorphic to H !" )
5106
+ else :
5107
+ raise ValueError ("This graph has no minor isomorphic to H !" )
5110
5108
5111
5109
rs = p .get_values (rs , convert = bool , tolerance = integrality_tolerance )
5112
5110
0 commit comments