sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

Need for FPT Algorithm for Vertex Cover of a Graph #37782

Open MumukshTayal opened 5 months ago

MumukshTayal commented 5 months ago

Problem Description

The goal is to implement a function that determines whether a given graph has a vertex cover of size less than or equal to a user-provided parameter k. This approach utilizes a Fixed Parameter Tractable (FPT) algorithm, which provides better performance compared to finding the exact minimum vertex cover size, especially for smaller values of k.

Proposed Solution

The proposed solution is an implementation of an FPT algorithm for the Vertex Cover problem. The algorithm checks if a graph has a vertex cover of size less than or equal to the user-provided parameter k. It does not return the exact size of the minimum vertex cover. The time complexity of this implementation is O(n^2 * 1.71^k), where n represents the size of the graph. The implementation of the proposed FPT algorithm is available in the following GitHub Gist

Alternatives Considered

Minimum Vertex Cover: The SageMath library already implements an algorithm for finding the minimum vertex cover size. However, this implementation uses Cython, which may outperform the proposed Python implementation in certain cases, particularly when the size of the minimum vertex cover is close to the parameter k.

Additional Information

Is there an existing issue for this?

MumukshTayal commented 5 months ago

@dcoudert I have been preparing the PR for this issue, however, @SandwichGouda seems to have raised a PR in place. However, the code implementation he has added seems very similar to mine with just some very minute modifications (mostly, method names changed). I had also already provided the link to the code implementation github gist (https://gist.github.com/MumukshTayal/279d02dc1188dea55cdad8dfd6335c0e) in the above issue itself (which was added last week). Moreover, I do have some resources which provide the intuition/ high level description for the implemented algorithm.

Besides, based on your provided inputs in the comments to the PR #37806 by @SandwichGouda, there are certain modifications that I have been considering and working on. Allow me some time for that.

dcoudert commented 5 months ago

I see... May be you could join forces with @SandwichGouda to get a better code ? I don't know if it is possible to have 2 developers for the same PR.

dimpase commented 5 months ago

Surely, a developer can open a PR on the fork of another developer - then, if accepted, the corresponding commits will have correct authorship.