Skip to content

Conversation

Ordoviz
Copy link
Contributor

@Ordoviz Ordoviz commented Sep 16, 2025

For a graph G, len(G.vertex_cover()) should always equal G.vertex_cover(value_only=True), but this was not the case when G is a disconnected BipartiteGraph. The fix is shockingly simple.

Copy link

Documentation preview for this PR (built with commit ecaab20; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

FYI, an alternative fix is to add value_only=value_only to the call to vertex cover on each connected component.

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 19, 2025
sagemathgh-40836: Fix BipartiteGraph.vertex_cover(value_only=True) for disconnected graphs
    
For a graph G, `len(G.vertex_cover())` should always equal
`G.vertex_cover(value_only=True)`, but this was not the case when G is a
disconnected `BipartiteGraph`. The fix is shockingly simple.
    
URL: sagemath#40836
Reported by: Lennard Hofmann
Reviewer(s): David Coudert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants