Giter Site home page Giter Site logo

nikolasent / clique-bron-kerbosch Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 5.0 435 KB

Bron–Kerbosch algorithm implementation for finding maximal cliques in an undirected graph with OpenGL visualization

C 30.13% C++ 69.87%
graph clique bron-kerbosch-algorithm maximal-cliques-finding maximal-cliques algorithm

clique-bron-kerbosch's Introduction

The maximal cliques finding with Bron–Kerbosch algorithm

The project code implements the Bron–Kerbosch algorithm for finding maximal cliques in an undirected graph and visualize results.

Title animated image

The algorithm uses branch and bound approach for efficient maximal cliques finding. For details see original publication by Bron C., Kerbosh J. (1973). Visualisation was realized with the GLFW library.

Originally, the project was developed in Dec 2014.

Content of this repo

  • scr/test/main.c code for testing without visualisation
  • scr/vis/main.cpp final project code
  • examples directory with sample input files graphs for quick testing
  • clique.exe precompiled project code.

How to run the code

Precompiled program

For quick start you can run the precompiled clique.exe file (with two arguments: paths to the input and output files) as following:

clique.exe examples\graf2.txt output2.txt

It was tested on Win 7/8/10.

Source code

Feel free to examine the sourse code in the scr directory and compile it on your own with your favourite compiler. It will need the open GLFW library.

The input file format

The input file should be an ordinary text file. The first row should contain only one number - number of vertices. 64 vertices is the maximum! The following lines should describe the graph connectivity. 1 in i-th row on j-th place means that the i-th vertices is connected with the j-th (j>i). Here it is an example (graf2.txt):

10
1 1 1 1 1 0 0 0 0 
1 1 1 0 1 0 0 0 
1 1 0 0 1 0 0 
1 0 0 0 1 0 
0 0 0 0 1 
1 1 1 1  
1 1 1 
1 1 
1 

example graf2.txt

The first vertice is marked in color. Vertices are numbered counterclockwise.

The output file format

In the described above example there are 2 same size maximal cliques. They are printed out in the output file as following:

Full connected group:
1 2 3 4 5 
6 7 8 9 10 
Total 2 groups with 5 vertices.

Press Enter button to see results visualisation (or to switch between maximal cliques if there is more then one solutio) and Escape to close the program.

Clique 1 Clique 2

Authors

clique-bron-kerbosch's People

Contributors

nikolasent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  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.