-
-
Notifications
You must be signed in to change notification settings - Fork 631
avoid some conversions to short_digraph
when the input is an instance of StaticSparseBackend
#39216
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
Merged
vbraun
merged 15 commits into
sagemath:develop
from
dcoudert:graphs/avoid_some_conversions_to_static
Feb 28, 2025
Merged
avoid some conversions to short_digraph
when the input is an instance of StaticSparseBackend
#39216
vbraun
merged 15 commits into
sagemath:develop
from
dcoudert:graphs/avoid_some_conversions_to_static
Feb 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Documentation preview for this PR (built with commit 2f9c52d; changes) is ready! 🎉 |
This was referenced Dec 28, 2024
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 1, 2025
sagemathgh-39217: improve graph traversal methods Similarly to sagemath#39216, we avoid the conversion to `short_digraph` when the input graph is an instance of `StaticSparseBackend`. Furthermore, we use the new `PairingHeap_of_n_integers` data structure (sagemath#39046) instead of a `priority_queue` to emulate a max-heap. This is slightly faster this way and cleaner. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39217 Reported by: David Coudert Reviewer(s): Travis Scrimshaw
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 3, 2025
sagemathgh-39217: improve graph traversal methods Similarly to sagemath#39216, we avoid the conversion to `short_digraph` when the input graph is an instance of `StaticSparseBackend`. Furthermore, we use the new `PairingHeap_of_n_integers` data structure (sagemath#39046) instead of a `priority_queue` to emulate a max-heap. This is slightly faster this way and cleaner. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39217 Reported by: David Coudert Reviewer(s): Travis Scrimshaw
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 20, 2025
sagemathgh-39223: avoid some conversions to `short_digraph` in `distances_all_pairs.pyx` Similarly to sagemath#39216, we avoid the conversion to `short_digraph` in `distances_all_pairs.pyx` when the input graph is an instance of `StaticSparseBackend`. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39223 Reported by: David Coudert Reviewer(s): Frédéric Chapoton
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 23, 2025
sagemathgh-39223: avoid some conversions to `short_digraph` in `distances_all_pairs.pyx` Similarly to sagemath#39216, we avoid the conversion to `short_digraph` in `distances_all_pairs.pyx` when the input graph is an instance of `StaticSparseBackend`. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39223 Reported by: David Coudert Reviewer(s): Frédéric Chapoton
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 25, 2025
sagemathgh-39223: avoid some conversions to `short_digraph` in `distances_all_pairs.pyx` Similarly to sagemath#39216, we avoid the conversion to `short_digraph` in `distances_all_pairs.pyx` when the input graph is an instance of `StaticSparseBackend`. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39223 Reported by: David Coudert Reviewer(s): Frédéric Chapoton
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 26, 2025
sagemathgh-39223: avoid some conversions to `short_digraph` in `distances_all_pairs.pyx` Similarly to sagemath#39216, we avoid the conversion to `short_digraph` in `distances_all_pairs.pyx` when the input graph is an instance of `StaticSparseBackend`. ### 📝 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, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39223 Reported by: David Coudert Reviewer(s): Frédéric Chapoton
fchapoton
reviewed
Feb 23, 2025
fchapoton
reviewed
Feb 23, 2025
fchapoton
reviewed
Feb 23, 2025
fchapoton
approved these changes
Feb 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, avanti
Merci. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Many methods convert the input graph to a
short_digraph
for faster operations. When the input is an instance ofStaticSparseBackend
, we can directly get theshort_digraph
and so avoid the extra cost of the conversion.On the way, we fix some memory leaks as some instances of
short_digraph
were not freed.In a follow-up PR, we will do more in
distances_all_pairs.pyx
,hyperbolicity.pyx
andtraversals.pyx
.📝 Checklist
⌛ Dependencies