Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.canonical_label() errors on bipartite graphs when partition= is not specified #38832

Closed
2 tasks done
maxale opened this issue Oct 20, 2024 · 1 comment · Fixed by #38842
Closed
2 tasks done

.canonical_label() errors on bipartite graphs when partition= is not specified #38832

maxale opened this issue Oct 20, 2024 · 1 comment · Fixed by #38842

Comments

@maxale
Copy link
Contributor

maxale commented Oct 20, 2024

Steps To Reproduce

sage: G = BipartiteGraph( matrix([[1,1],[1,1]]) )
sage: G.canonical_label()
[...]
TypeError: itertools.chain() argument after * must be an iterable, not NoneType

Expected Behavior

Should work.

Actual Behavior

TypeError

Additional Information

Specifying partition= eliminates the issue:

sage: G.canonical_label(partition=G.bipartition())
Bipartite graph on 4 vertices

Perhaps, G.bipartition() should be the default value for partition= in the case of bipartite graphs.

Environment

  • OS: Ubuntu 24.04.1 LTS
  • Sage Version: 10.5.beta6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@maxale maxale added the t: bug label Oct 20, 2024
@maxale maxale changed the title .canonical_label() is broken for bipartite graphs .canonical_label() errors on bipartite graphs when partition= is not specified Oct 20, 2024
dcoudert added a commit to dcoudert/sage that referenced this issue Oct 23, 2024
@dcoudert
Copy link
Contributor

good catch. I pushed a possible fix in #38842.

vbraun pushed a commit to vbraun/sage that referenced this issue Oct 26, 2024
… bipartite graphs

    
Fixes sagemath#38832.

We fix call to `canonical_label` on `BipartiteGraph` when parameter
`partition` is `None`.
```py
sage: G = BipartiteGraph(matrix([[1, 1], [1, 1]]))
sage: C = G.canonical_label()
sage: C.left, C.right
({0, 1}, {2, 3})
```


### 📝 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.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38842
Reported by: David Coudert
Reviewer(s): Kwankyu Lee
@vbraun vbraun closed this as completed in f2780d8 Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants