@@ -4901,7 +4901,7 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
4901
4901
been merged to create a new graph `G'`, this new graph contains `H` as a
4902
4902
subgraph.
4903
4903
4904
- When parameter ``induced`` is ``True``, this method returns an induced minor
4904
+ When parameter ``induced`` is ``True``, this method returns an induced minor
4905
4905
isomorphic to `H`, if it exists.
4906
4906
4907
4907
We say that a graph `G` has an induced `H`-minor (or that it has a
@@ -4931,7 +4931,8 @@ 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 :class:`ValueError` otherwise.
4934
+ induced minor isomorphic to `H` if it exists, and raises a
4935
+ :class:`ValueError` otherwise.
4935
4936
4936
4937
OUTPUT:
4937
4938
@@ -4991,21 +4992,24 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
4991
4992
...
4992
4993
ValueError: This graph has no minor isomorphic to H !
4993
4994
4994
- Trying to find an induced minor for a graph with a C6 cycle::
4995
+ Trying to find an induced minor isomorphic to `C_5` in a graph
4996
+ containing an induced `C_6`::
4995
4997
4996
- sage: g = graphs.CycleGraph(6) # Create a graph with 6 vertices forming a C6 cycle
4997
- sage: for i in random. randint(10, 30):
4998
- ....: g.add_edge(random. randint(0, 5), i )
4999
- sage: h = graphs.CycleGraph(5) # Create a graph with 5 vertices forming a C5 cycle
5000
- sage: L = g.minor(h, induced=True)
5001
- sage: gg = g.subgraph(flatten(L.values(), max_level = 1))
5002
- sage: _ = [gg.merge_vertices(l) for l in L.values() if len(l)> 1]
4998
+ sage: g = graphs.CycleGraph(6)
4999
+ sage: for i in range( randint(10, 30) ):
5000
+ ....: g.add_edge(randint(0, 5), g.add_vertex() )
5001
+ sage: h = graphs.CycleGraph(5)
5002
+ sage: L = g.minor(h, induced=True)
5003
+ sage: gg = g.subgraph(flatten(L.values(), max_level= 1))
5004
+ sage: _ = [gg.merge_vertices(l) for l in L.values() if len(l) > 1]
5003
5005
sage: gg.is_isomorphic(h)
5004
5006
True
5005
5007
5006
5008
TESTS::
5007
5009
5008
- sage: # a graph `g` may have minor but no induced minor isomorphic to given graph `h`
5010
+ A graph `g` may have a minor isomorphic to a given graph `h` but no
5011
+ induced minor isomorphic to `h`::
5012
+
5009
5013
sage: g = Graph([(0, 1), (0, 2), (1, 2), (2, 3), (3, 4), (3, 5), (4, 5), (6, 5)])
5010
5014
sage: h = Graph([(9, 10), (9, 11), (9, 12), (9, 13)])
5011
5015
sage: l = g.minor(h, induced=False)
@@ -5014,11 +5018,14 @@ def minor(self, H, solver=None, verbose=0, induced=False, *, integrality_toleran
5014
5018
...
5015
5019
ValueError: This graph has no induced minor isomorphic to H !
5016
5020
5021
+ Checking that the returned induced minor is isomorphic to the given
5022
+ graph::
5023
+
5017
5024
sage: g = Graph([(0, 1), (0, 2), (1, 2), (2, 3), (3, 4), (3, 5), (4, 5), (6, 5)])
5018
5025
sage: h = Graph([(7, 8), (8, 9), (9, 10), (10, 11)])
5019
5026
sage: L = g.minor(h, induced=True)
5020
- sage: gg = g.subgraph(flatten(L.values(), max_level = 1))
5021
- sage: _ = [gg.merge_vertices(l) for l in L.values() if len(l)> 1]
5027
+ sage: gg = g.subgraph(flatten(L.values(), max_level= 1))
5028
+ sage: _ = [gg.merge_vertices(l) for l in L.values() if len(l) > 1]
5022
5029
sage: gg.is_isomorphic(h)
5023
5030
True
5024
5031
"""
0 commit comments