Giter Site home page Giter Site logo

mcoric96 / greedy-graph-coloring Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 17 KB

Greedy graph coloring - comparison of programming paradigms - logic programming vs functional programming

JavaScript 74.38% Prolog 25.62%
functional-programming logic-programming prolog programming-paradigms graph-coloring greedy-coloring

greedy-graph-coloring's Introduction

Greedy-graph-coloring

Simple comparison of logic and functional programming paradigm using graph coloring problem for programming paradigms course.
Sequential greedy coloring algorithm: https://en.wikipedia.org/wiki/Greedy_coloring

Algorithm
1.Color first vertex with first color.
2.Do following for remaining V-1 vertices.
---Consider the currently picked vertex and color it with the
---lowest numbered color that has not been used on any previously
---colored vertices adjacent to it. If all previously used colors
---appear on vertices adjacent to v, assign a new color to it.

Logical programming - Prolog
Functional programming - JavaScript

In this case,this is not pure functional programming, but mix of functional and OOP because of implementation of a graph, but coloring algorithm uses main properties of functional paradigm.
For this problem and similar problems that require searching techniques logic programming seems to be better solution regarding code complexity because of the various search implementations in Prolog.

greedy-graph-coloring's People

Contributors

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