-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-37345: implemented function for acyclic orientations
<!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> **Description** This PR introduces an efficient algorithm for generating all acyclic orientations of an undirected graph based on the work by Mathew B. Squire. The algorithm utilizes a recursive approach along with concepts from posets and subsets to improve the efficiency of acyclic orientation generation significantly. **Changes Made** 1. Implemented the reorder_vertices function to efficiently reorder vertices based on a specific criterion, improving subsequent acyclic orientation generation. 2. Created the order_edges function to assign labels to edges based on the reordered vertices, simplifying the acyclic orientation process. 3. Introduced the generate_orientations function to efficiently generate acyclic orientations by considering subsets of edges and checking for upsets in a corresponding poset. 4. Implemented the recursive helper function to generate acyclic orientations for smaller graphs, building up to larger graphs. 5. Modified the main function to use SageMath for graph manipulation and incorporated the new algorithm. Fixes #37253 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [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 accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #37345 Reported by: saatvikraoIITGN Reviewer(s): David Coudert, grhkm21, saatvikraoIITGN
- Loading branch information
Showing
3 changed files
with
264 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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