GithubHelp home page GithubHelp logo

circom_three_coloring's Introduction

Circom Three Coloring

Verifying if a graph has a valid Three Coloring in Circom.

An edge list of different integers as nodes is used to represent a graph. For example,

"graph": [[0,1],[0,2],[1,2]],

creates the following graph:

   0
  / \
 1---2

To reprsesent the colors of each node, a separate colors array is used

"colors": [0,1,2]

where each number in colors represents a different color. The index in the array maps to the color of the ith node. For example, colors[1] will give you the color of the node labeled 1.

Combining these two inputs, a colored graph is represented programmatically.

Run

First, clone this repo using the following command:

git clone https://github.com/lognorman20/circom_three_coloring.git

Next, ensure that you've installed Circom and SnarkJS.

Use the Makefile to run core operations. A description of each option is as follows:

make all: Cleans the directory, compiles the Circom circuit, generates witnesses, fully runs the Powers of Tau Ceremony, and finally generates and verifies a proof for the circuit given a set of witnesses. The witnesses used are in circuits/input.json.

make circuit: Compiles the Circom circuit and generates witnesses. The output can be found in artifacts/compilation.

make ptau: Runs the Powers of Tau Ceremony. make circuit must be ran before this command. The output can be found in artifacts/setup.

make proof: Generates and verifies a proof for the circuit given the inputs in circuits/input.json. The output can be found in artifacts/proof.

make clean: Cleans the repository of all files relating to the compilation, setup, or proving stage.

To change the inputs of the proof, alter the circuits/input.json file's contents. The file contains two keys:

{
    "graph": [[0,1],[1,2],[2,3],[2,4],[3,4],[4,0]],
    "colors": [0,1,0,1,2]
}

Additionally, change the inputs to circuits/main.circom need to be changed.

component main {public [ graph ]} = ThreeColoring(N,M);

Set N (number of nodes) and M (number of edges) according to the graph in input.json.

circom_three_coloring's People

Contributors

lognorman20 avatar

Watchers

 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.