Skip to content

Commit ed67c60

Browse files
committed
planar_graphs: support minimum_connectivity=4
1 parent 5c8d9e9 commit ed67c60

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/sage/graphs/graph_generators.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,16 +2033,15 @@ def planar_graphs(self, order, minimum_degree=None,
20332033
minimum connectivity is also equal to ``None``, then this is set to 1.
20342034
20352035
- ``minimum_connectivity`` -- (default: ``None``) a value `\geq 1`
2036-
and `\leq 3`, or ``None``. This specifies the minimum connectivity of the
2036+
and `\leq 4`, or ``None``. This specifies the minimum connectivity of the
20372037
generated graphs. If this is ``None`` and the minimum degree is
20382038
specified, then this is set to the minimum of the minimum degree
20392039
and 3. If the minimum degree is also equal to ``None``, then this
20402040
is set to 1.
20412041
20422042
- ``exact_connectivity`` -- (default: ``False``) if ``True`` only
20432043
graphs with exactly the specified connectivity will be generated.
2044-
This option cannot be used with ``minimum_connectivity=3``, or if
2045-
the minimum connectivity is not explicitly set.
2044+
This option requires ``minimum_connectivity`` to be set to 1 or 2.
20462045
20472046
- ``minimum_edges`` -- integer (default: ``None``); lower bound on the
20482047
number of edges
@@ -2150,6 +2149,15 @@ def planar_graphs(self, order, minimum_degree=None,
21502149
sage: dual_planar_sizes = [g.size() for g in dual_planar]
21512150
sage: planar_sizes == dual_planar_sizes
21522151
True
2152+
2153+
Specifying extremal values for minimum connectivity::
2154+
2155+
sage: # optional - plantri
2156+
sage: gen = graphs.planar_graphs(5, minimum_connectivity=1, exact_connectivity=True)
2157+
sage: all(G.vertex_connectivity() == 1 for G in gen)
2158+
True
2159+
sage: len(list(graphs.planar_graphs(8, minimum_connectivity=4)))
2160+
4
21532161
"""
21542162
if order < 0:
21552163
raise ValueError("number of vertices should be nonnegative")
@@ -2161,8 +2169,8 @@ def planar_graphs(self, order, minimum_degree=None,
21612169
if exact_connectivity and minimum_connectivity is None:
21622170
raise ValueError("Minimum connectivity must be specified to use the exact_connectivity option.")
21632171

2164-
if minimum_connectivity is not None and not (1 <= minimum_connectivity <= 3):
2165-
raise ValueError("Minimum connectivity should be a number between 1 and 3.")
2172+
if minimum_connectivity is not None and not (1 <= minimum_connectivity <= 4):
2173+
raise ValueError("Minimum connectivity should be a number between 1 and 4.")
21662174

21672175
# minimum degree should be None or a number between 1 and 5
21682176
if minimum_degree == 0:
@@ -2185,9 +2193,9 @@ def planar_graphs(self, order, minimum_degree=None,
21852193
minimum_degree > 0):
21862194
raise ValueError("Minimum connectivity can be at most the minimum degree.")
21872195

2188-
# exact connectivity is not implemented for minimum connectivity 3
2189-
if exact_connectivity and minimum_connectivity == 3:
2190-
raise NotImplementedError("Generation of planar graphs with connectivity exactly 3 is not implemented.")
2196+
# exact connectivity is not implemented for minimum connectivity 3
2197+
if exact_connectivity and minimum_connectivity >= 3:
2198+
raise NotImplementedError(f"Generation of planar graphs with connectivity exactly {minimum_connectivity} is not implemented.")
21912199

21922200
if only_bipartite and minimum_degree > 3:
21932201
raise NotImplementedError("Generation of bipartite planar graphs with minimum degree 4 or 5 is not implemented.")

0 commit comments

Comments
 (0)