Skip to content

Commit

Permalink
gh-38726: fix issue 38723 in vertex_connectivity
Browse files Browse the repository at this point in the history
Fixes #38723.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->

URL: #38726
Reported by: David Coudert
Reviewer(s): John H. Palmieri
  • Loading branch information
Release Manager committed Sep 28, 2024
2 parents 4462607 + d9fa23d commit 2b4fe39
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=2cdffd348b8a4de62b51e1f6c37a7d414004c09e
sha256=273c37842eedefc3575e34bb14819ab3738a32c39ae634f2342bb50baa740c60
sha1=c49c5f48b308654286156805086bb6b74468290d
sha256=60a2a872c0f63813a888cf80e4d11f8d83fa16fb1c9c617d4fa64eea600b56a7
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9b58ceaa68960b38142f27fdfc04373301da4e46
2eb961239c84c157a3c7b44b5dba88590c96761c
16 changes: 13 additions & 3 deletions src/sage/graphs/connectivity.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,16 @@ def vertex_connectivity(G, value_only=True, sets=False, k=None, solver=None, ver
sage: G.add_edge(0, 1)
sage: G.vertex_connectivity(value_only=False, verbose=1) # needs sage.numerical.mip
(3, [])
Check that :issue:`38723` is fixed::
sage: G = graphs.SierpinskiGasketGraph(3)
sage: G.vertex_connectivity(k=1) # needs sage.numerical.mip
True
sage: G.vertex_connectivity(k=2) # needs sage.numerical.mip
True
sage: G.vertex_connectivity(k=3) # needs sage.numerical.mip
False
"""
from sage.graphs.generic_graph import GenericGraph
if not isinstance(G, GenericGraph):
Expand All @@ -1622,8 +1632,8 @@ def vertex_connectivity(G, value_only=True, sets=False, k=None, solver=None, ver
# We follow the convention of is_connected, is_biconnected and
# is_strongly_connected
return k == 1
if (g.is_directed() and k > min(min(g.in_degree()), min(g.out_degree()))) \
or (not g.is_directed() and (k > min(g.degree()))):
if ((g.is_directed() and k > min(min(g.in_degree()), min(g.out_degree())))
or (not g.is_directed() and (k > min(g.degree())))):
return False
value_only = True
sets = False
Expand Down Expand Up @@ -1655,7 +1665,7 @@ def vertex_connectivity(G, value_only=True, sets=False, k=None, solver=None, ver
return 1 if k is None else (k == 1)

if not G.is_triconnected():
return 2 if k is None else (k == 2)
return 2 if k is None else (k <= 2)
elif k == 3:
return True

Expand Down

0 comments on commit 2b4fe39

Please sign in to comment.