The graph partition problem is a problem in computer science in which we are given a graph and a positive number k, and the goal is to partition the vertices of the graph in to k disjoint sets such that the sum of the weights of the cut edges are minimized.
There are many solution approaches to Graph Partitioning Problem. In this repository, we include the solution approach of Kernighan-Lin Algorithm (KL) and Fiduccia-Mattheyeses Algorithm (FM). KL algorithm is implemented in Python and FM algorithm is implemented in CPP.
Python Codes
- Clone the repository to you local machine.
- Create a virtual environment.
- Install required libraries by
pip install -r requirements.txt
- Run the required algorithms from their specific folders.
CPP Codes
-
In the terminal, navigate to project directory and create a new directory called 'build'.
mkdir build cd build
-
From the 'build' directory, run the following command to generate the build files:
cmake ..
This will generate the build files according to the cmake file provided. -
To build the project, run the following command:
cmake --build
This will build the executable for the project. -
To run the program, use the following command:
./FM
-
Give the file path as input when the prompt is shown.