Giter Club home page Giter Club logo

graphcolouring's Introduction

graphcolouring

Graph Colouring Problem Code

The steps followed for solving a graph coloring problem using SAT are as follows:

  1. Input :

    a. Number of nodes

    b. Edges in the form of adjacency matrix

    c. Number of Colors

  2. Identification of variables

    Example :: If a graph contains 4 nodes, say, a,b,c,d, then we these as 4 variables and also acolx,bcolx,ccolx,dcolx which are the logical variables and indicates if the vertices can have same or different colours with respect to the other vertex x.

  3. Construction of Clauses

    Example :: (~a v ~b) is 1 means there exists an Edge between Vertex a and Vertex b. [a and b are the values for a and b in the adjacency matrix in the row for a or b]

  4. a. Assigning two colors(1 or 2) to vertices to specify if they can take same or different color values, on the basis of truth values assigned to literals, with respect to each vertex. [1 and 2 are not actual colors]

    1 means possibility of same color. 2 means must have different color.

    Example :: When (a v b) is 1 then Vertex b will be assigned 2 when checking Vertex a, else 1 will be assigned.

  5. a. Checking for each vertex, if the other vertices have different color possibility with respect to it.

    b. Then assign different color value if value assigned in last step is 2.

    c. If the vertices have same color possibility, check if they are not adjacent to any other vertex having the possibility of same color. Example :: When checking with respect to vertex a, (~b v ~c) checks if edge exists between b and c. Then (~ccola v ~bcola) checks if b and c can have same colour with respect to a. Then (~b v ~c) v (~ccola v ~bcola) decides if b can hav same colour as a or not.

    d. If yes, then assign different color.

graphcolouring's People

Contributors

sadimanna avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.