Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1.71 KB

README.md

File metadata and controls

37 lines (28 loc) · 1.71 KB

GCP To SAT

A simple python code which reduces the Graph Colorablity Problem to Boolean Satisfiability Problem.

Requirements

  1. Python 3
  2. minisat solver from https://github.com/niklasso/minisat

Install Instructions

  1. cd to your home directory cd ~
  2. create new folder for git repositories mkdir gitRepos
  3. cd to the newly created folder cd gitRepos
  4. clone this repo to you folder git clone https://github.com/hackrush01/GCPToSAT.git
  5. cd to the repo cd GCPToSAT
  6. run sudo pip3 install -r pip.txt
  7. run using python3 GCP_To_SAT.py <path-to-graph-file>

Note: Complete installation instructions for MiniSat Solver are mentioned in it's respective repository but in short:

  1. cd to your git repo folder created above cd ~/gitRepos
  2. clone minisat git clone https://github.com/niklasso/minisat.git
  3. cd to minisat directory cd minisat
  4. install using sudo make install

How to run

Just install the minisat solver in your preferred linux distro. After that just execute the python file.

Input Format

Make a graph.txt file in the same directory as the git repository or run the program as follows python3 GCP_To_SAT.py <path-to-graph-file>.

It's important to note that the graph text file must adhere to the standard input format i.e.

  1. First line contains exactly one number defining the number of vertices.
  2. After that each line should contain exactly one edge with space separated vertices.(e.g. 5 8, indicates an edge between 5th and 8th vertices)
  3. All edges are 1-indexed.
  4. Since the graph is undirectional, so the edges should not be repeated. It doesn't change the solution but the number of clauses increases, decreasing the performance. One example graph.txt file is included.