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

graphs: implementation of linear-time algorithm for modular decomposition #39038

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

cyrilbouvier
Copy link
Contributor

This PR implements the recursive, linear-time algorithm to compute the modular decomposition of simple undirected graphs from TCHP2008.

A previous implementation was introduced in version 9.7 but was removed after some bugs were discovered (see #25872 for exemple).

This implementation is based on an updated version of the article and is intensively tested.

This PR contains:

  • a implementation in C++ of the algorithm (in the file graph_decompositions/modular_decomposition.hpp) and the corresponding interface file graph_decompositions/modular_decomposition.pxd
  • a small reorganization of the method modular_decomposition of the class Graph: this method now accept a parameter algorithm (that can be 'habib_maurer' for the previous algorithm, or 'corneil_habib_paul_tedder' for the new one, which is the default value), it then call the function modular_decomposition from graph_decompositions/modular_decomposition.pyx which dispatch the call to the correct function (habib_maurer_algorithm or corneil_habib_paul_tedder_algorithm)
  • a new parameter algorithm for the is_prime method (which is passed directly to the modular_decomposition method)
  • a new is_module method for the Graph class
  • a small clean up of the file graph_decompositions/modular_decomposition.pyx to remove unused field of the Node class and useless functions.
  • a new prime_node_generator parameter for the md_tree_to_graph (used for generating modular decomposition tree for tests)

In this PR, I did not change the output of the modular_decomposition method to keep the changes to a minimum.
If this PR is accepted, I intend to do it in another PR. The goal would be to return a object that contains all the information of the modular decomposition tree: currently the two formats for the output have no information for the prime graph corresponding to prime nodes. It can be computed from the output of the new algorithm but this information is lost during the conversion to one of the output format of the method modular_decomposition.

📝 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 Nov 26, 2024

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

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.

1 participant