Skip to content

Overwrote methods concerning subdivision of edge(s) in a matching covered graph #40090

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
merged 13 commits into from
Jul 25, 2025

Conversation

janmenjayap
Copy link
Contributor

The objective of this issue is to overwrite the methods pertaining to subdivision of edges in a matching covered graph.

More specifically, this PR aims to overwrite the following methods:

  • subdivide_edge() | Subdivide an edge k times.
  • subdivide_edges() | Subdivide k times edges from an iterable container.

This PR shall address the methods related to subdivision of edge(s) in matching covered graphs.

Fixes #38216.
Note that this issue fixes a small part of the mentioned issue.

This issue is the fresh restart of the issue #39650.

📝 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

Nothing as of now.

cc: @dcoudert.

@janmenjayap janmenjayap changed the title Overwrote methods concerning subdivision of edges in a matching covered graph Overwrote methods concerning subdivision of edge(s) in a matching covered graph May 12, 2025
@janmenjayap
Copy link
Contributor Author

By the way,
While running ./sage -t src/sage/graphs/matching_covered_graph.py in my local, I have been getting this error

  File "/home/janmenjaya/open-source/sage/src/bin/sage-runtests", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/__main__.py", line 192, in main
    err = DC.run()
          ^^^^^^^^
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/control.py", line 1613, in run
    self.run_doctests()
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/control.py", line 1197, in run_doctests
    self.dispatcher = DocTestDispatcher(self)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/forker.py", line 1745, in __init__
    init_sage(controller)
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/forker.py", line 218, in init_sage
    controller.load_environment()
  File "/home/janmenjaya/open-source/sage/src/sage/doctest/control.py", line 699, in load_environment
    return import_module(self.options.environment)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/janmenjaya/open-source/sage/local/var/lib/sage/venv-python3.12.5/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/janmenjaya/open-source/sage/src/sage/repl/ipython_kernel/all_jupyter.py", line 6, in <module>
    from sage.all_cmdline import *
  File "/home/janmenjaya/open-source/sage/src/sage/all_cmdline.py", line 17, in <module>
    from sage.all import *
  File "/home/janmenjaya/open-source/sage/src/sage/all.py", line 97, in <module>
    from sage.graphs.all import *
  File "/home/janmenjaya/open-source/sage/src/sage/graphs/all.py", line 9, in <module>
    from sage.graphs.graph import Graph
  File "/home/janmenjaya/open-source/sage/src/sage/graphs/graph.py", line 436, in <module>
    class Graph(GenericGraph):
  File "/home/janmenjaya/open-source/sage/src/sage/graphs/graph.py", line 9551, in Graph
    from sage.graphs.connectivity import minimal_separators
ImportError: cannot import name 'minimal_separators' from 'sage.graphs.connectivity' (/home/janmenjaya/open-source/sage/src/sage/graphs/connectivity.cpython-312-x86_64-linux-gnu.so)

So, I essentially, just comment the line,

from sage.graphs.connectivity import minimal_separators

and the line

"minimal_separators"        : "Connectivity, orientations, trees",

in graph.py and run the doctests (which passes the tests). Any comments on this?

@dcoudert
Copy link
Contributor

The problem should be elsewhere in your configuration. I don't have this issue on my local installation (macOS and fedora).

@janmenjayap
Copy link
Contributor Author

Hi @dcoudert,
Please do let me know, if anything else is required to be done.

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.

Copy link

github-actions bot commented Jun 22, 2025

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

@dcoudert
Copy link
Contributor

Make this test more robust

sage -t --warn-long 5.0 --random-seed=334098958671645686078940818804175858609 src/sage/graphs/matching_covered_graph.py
**********************************************************************
Error: Failed example:: Got: ([(0, 4, None),
  (0, 6, None),
  (1, 5, None),
  (1, 7, None),
  (4, 5, None),
  (6, 7, None)],
 [])
                                                                                                                                                                                                                                                                                                                                                                          
    sorted([f for f in F if f not in E]), sorted([e for e in E if e not in F])
Expected:
    ([(0, 4, None), (0, 6, None), (1, 5, None), (1, 7, None),
      (4, 5, None), (6, 7, None)], [(0, 1, None), (0, 1, None)])
Got:
    ([(0, 4, None),
      (0, 6, None),
      (1, 5, None),
      (1, 7, None),
      (4, 5, None),
      (6, 7, None)],
     [])

@dcoudert
Copy link
Contributor

You still have to fix doctests

@janmenjayap
Copy link
Contributor Author

Hi @dcoudert,

Apologies for the delay in this. In my local, it was passing all the doctests. I have been building the sage again after all the recent changes. I will fix this PR soon.

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.

LGTM.

@dcoudert dcoudert added s: positive review gsoc: 2025 Tag for GSoC2025 issues/PRs labels Jul 15, 2025
@janmenjayap
Copy link
Contributor Author

Thank you.

vbraun pushed a commit to vbraun/sage that referenced this pull request Jul 18, 2025
sagemathgh-40090: Overwrote methods concerning subdivision of edge(s) in a matching covered graph
    
<!-- ^ Please provide a concise and informative title. -->
The objective of this issue is to overwrite the methods pertaining to
subdivision of edges in a matching covered graph.

<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
More specifically, this PR aims to overwrite the following methods:
- [x]  `subdivide_edge()` | Subdivide an edge `k` times.
- [x]  `subdivide_edges()` | Subdivide `k` times edges from an iterable
container.

<!-- v Why is this change required? What problem does it solve? -->
This PR shall address the methods related to subdivision of edge(s) in
matching covered graphs.

<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->
Fixes sagemath#38216.
Note that this issue fixes a small part of the mentioned issue.

This issue is the fresh restart of the issue sagemath#39650.

### 📝 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
Nothing as of now.

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->

cc: @dcoudert.
    
URL: sagemath#40090
Reported by: Janmenjaya Panda
Reviewer(s): David Coudert, Janmenjaya Panda
@vbraun vbraun merged commit adddfb5 into sagemath:develop Jul 25, 2025
21 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: graph theory gsoc: 2025 Tag for GSoC2025 issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On Decompositions, Generation Methods and related concepts in the theory of Matching Covered Graphs
3 participants