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

add method is_vertex_cut to (di)graphs #38418

Merged
merged 3 commits into from
Oct 12, 2024

Conversation

dcoudert
Copy link
Contributor

This PR answers a query from https://ask.sagemath.org/question/78391/does-sage-have-a-function-to-determine-vertex-cuts/

It adds to (di)graphs a method to check if a set of vertices is a vertex cut of the (di)graph, that is if its removal from the (di)graph increases the number of (strongly) connected components. This generalizes method is_cut_vertex.

📝 Checklist

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

⌛ Dependencies

Copy link

github-actions bot commented Jul 24, 2024

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

@lichengzhang1
Copy link

For edge versions, a similar problem involves adding a method is_edge_cut to (di)graphs.

@dcoudert
Copy link
Contributor Author

For edge versions, a similar problem involves adding a method is_edge_cut to (di)graphs.

Sure, but this should be done in another PR. This one is large enough.

@dcoudert dcoudert mentioned this pull request Jul 27, 2024
5 tasks
@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 6, 2024

@fchapoton I need some help here to rebase this branch. I tried to rebase on develop and fix merge conflicts, but push was rejected

MAC-04017247:sage dcoudert$ git push origin HEAD:"graphs/is_vertex_cut"
To https://github.com/dcoudert/sage.git
 ! [rejected]                HEAD -> graphs/is_vertex_cut (non-fast-forward)
error: failed to push some refs to 'https://github.com/dcoudert/sage.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

@fchapoton
Copy link
Contributor

say "thank you" to the recent doc patch-bombe..

I am not sure how to handle that properly ; my only safe strategy is the following :

did you try to click on the "resolve conflicts" button here and fix the conflicts online ?

@fchapoton
Copy link
Contributor

  • are you sure you have the latest develop ?
  • you can use "git push -f" to force the push, but be cautious..

@fchapoton
Copy link
Contributor

il y a des instructions precises quand on clique sur "use the command line"

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 6, 2024

  • I can't click on "resolve conflicts". It says that "These conflicts are too complex to resolve in the web editor"
  • I have the last develop branch (according my clone on GitHub, and git pull)
  • I don't see any "use the command line" button
  • I will try a forced push...

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 6, 2024

Thanks @fchapoton, the forced push seems ok.

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 5, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 6, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 8, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 8, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 10, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 12, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 14, 2024
    
Similarly to sagemath#38418, this PR adds a method to check whether a set of
edges forms an edge cut of the (di)graph, that is if the removal of
these edges increases the number of (weakly) connected components.


### 📝 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#38435
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee
@dcoudert
Copy link
Contributor Author

something went wrong with my last commit, trying to fix a merge conflict with 10.5.beta4.... I'm not sure how to fix that.
Any advice is more than welcome.

@fchapoton
Copy link
Contributor

well, github requires that the branch is rebased on top of the latest develop. If you merge instead, you git these hundreds of commits..

@fchapoton
Copy link
Contributor

more precisely the commit message must look like
```Merge branch 'develop' into my_cool_branch``

@dcoudert
Copy link
Contributor Author

I have restarted a branch on top of 10.5.beta4 with a forced push. It should be ok now.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 29, 2024

    :meth:`is_cut_vertex` | Check whether the input vertex is a cut-vertex.
    :meth:`is_vertex_cut` | Check whether the input vertices form a vertex cut.

This is confusing to me. So is_vertex_cut(G, [v]) does the same with is_cut_vertex(G, v)?

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 29, 2024

"cut vertex" seems a precise term, but "vertex cut" seems not. Do you agree?

@dcoudert
Copy link
Contributor Author

  1. Yes, is_vertex_cut(G, [v]) does the same than is_cut_vertex(G, v).
  2. A set of edges whose removal from the graph increases the number of connected components is called a edge cut of the graph. Similarly, a set of vertices whose removal from the graph increases the number of connected components is called a vertex cut. So the terminology used here is the right one. When you refer to a cut vertex v, you refer to a single vertex whose removal increases the number of connected components.

Now, we can ask if method is_cut_vertex is still needed when we have the more general method is_vertex_cut, and knowing that method is_cut_vertex simply calls method is_vertex_cut. The same question holds for methods is_cut_edge and is_edge_cut.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 29, 2024

OK. Thanks. Reasonable.

Copy link
Collaborator

@kwankyu kwankyu left a comment

Choose a reason for hiding this comment

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

LGTM.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 29, 2024

I will wait for ci checks.

@dcoudert
Copy link
Contributor Author

dcoudert commented Oct 6, 2024

The error reported by CI in sage -t --long --random-seed=286735480429121101562228604801325644303 src/sage/schemes/elliptic_curves/hom_frobenius.py seems unrelated to changes done in this PR

@kwankyu
Copy link
Collaborator

kwankyu commented Oct 6, 2024

OK. Sorry that this PR got out of my radar.

@dcoudert
Copy link
Contributor Author

dcoudert commented Oct 6, 2024

Thank you for the review.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 9, 2024
    
This PR answers a query from
https://ask.sagemath.org/question/78391/does-sage-have-a-function-to-
determine-vertex-cuts/

It adds to (di)graphs a method to check if a set of vertices is a vertex
cut of the (di)graph, that is if its removal from the (di)graph
increases the number of (strongly) connected components. This
generalizes method `is_cut_vertex`.

### 📝 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#38418
Reported by: David Coudert
Reviewer(s): David Coudert, Kwankyu Lee, Matthias Köppe
@vbraun vbraun merged commit a30eb04 into sagemath:develop Oct 12, 2024
19 of 20 checks passed
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.

6 participants