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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Graph.add_clique() for one vertex #35511

Merged
merged 1 commit into from
Apr 23, 2023

Conversation

tornaria
Copy link
Contributor

Before the change:

sage: g = Graph()
sage: g.add_clique([1,2])
sage: g.add_clique([3])
sage: g.vertices(sort=True)
[1, 2]

After the change:

sage: g = Graph()
sage: g.add_clique([1,2])
sage: g.add_clique([3])
sage: g.vertices(sort=True)
[1, 2, 3]

馃摑 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have created tests covering the changes.

Before the change:

    sage: g = Graph()
    sage: g.add_clique([1,2])
    sage: g.add_clique([3])
    sage: g.vertices(sort=True)
    [1, 2]

After the change:

    sage: g = Graph()
    sage: g.add_clique([1,2])
    sage: g.add_clique([3])
    sage: g.vertices(sort=True)
    [1, 2, 3]
@github-actions
Copy link

Documentation preview for this PR is ready! 馃帀
Built with commit: eafa33c

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.

Thank you for fixing this issue.

LGTM.

@vbraun vbraun merged commit db2fa5d into sagemath:develop Apr 23, 2023
7 of 8 checks passed
vbraun pushed a commit that referenced this pull request Apr 23, 2023
    
Simplify the code; also, the previous code has to iterate over variables
of the sequence twice (this is really bad before #35510).

This affects mainly the method `connected_components()`.

EDIT:

Moreover, now we add a clique between the variables of each polynomial,
so it agrees with the description (the code before used to add just a
spanning tree of the clique -- a star).

This makes this method a little bit slower for the purposes of
`connected_components()` (for which adding a star is equivalent).

However, #35518 will rewrite `connected_components()` without using
`connection_graph()` so this is not really a problem.


### 馃摑 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] New tests added to check that a clique is added for the variables
in each polynomial.

### Dependencies
 - #35511
    
URL: #35512
Reported by: Gonzalo Tornar铆a
Reviewer(s): David Coudert, Gonzalo Tornar铆a, Vincent Delecroix
@mkoeppe mkoeppe added this to the sage-10.0 milestone Apr 23, 2023
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.

None yet

4 participants