Git Product home page Git Product logo

melon's Introduction

MELON

MELON stands for Modern and Efficient Library for Optimization in Networks. The goal of this project is to provide a graph library using modern C ++ functionalities in order to be more user-friendly than the Boost.Graph library while being as performant as the LEMON Graph library which is unfortunately not maintained and does not compile with C++ 20. Implemented data structures and algorithms are often benchmarked in the repository https://github.com/fhamonic/melon_benchmark and shown to outperform both Boost.Graph and LEMON!

Work in progress.

Generic badge Generic badge Generic badge Generic badge

How to link

The beauty of Conan 2.0 allows this library to be linked either as a Conan package Git/CMake submodule. In both cases you need a recent compiler (at least GCC 12).

As a Conan package (preferred)

Clone this repository and run:

make package

Then add the dependency to melon in your conanfile.txt or conanfile.py:

melon/0.5

As git and cmake submodules

Either clone or add this git as submodule in a folder named, for example, "dependencies"

mkdir dependencies && cd dependencies
git clone https://github.com/fhamonic/melon

or

mkdir dependencies
git submodule add https://github.com/fhamonic/melon dependencies/melon

Import the library and link it to your CMake targets with

add_subdirectory(dependencies/melon)
...
target_link_libraries(<some_target> INTERFACE melon)

Then ensure that your CMake can find Range-v3 and fmt with the corresponding find_package calls.

How to Compile and Run Tests

Having a compiler (GCC 12+ required), CMake and Conan, compile and run tests with

make

Documentation

The extensive use of C++20 concepts allows to provide genericity to the graph algorithms in the sense that they would work on any graph implementation fulfilling their requirements. We describe the fundamental concepts of the library and their motivation in the wiki page Concepts. Thus, this library aims to allow users to bring their own graph structures, best suited to their needs. However, we provide classical implementations of graphs such as 'static_digraph' and 'mutable_digraph'. The graph structures provided are described in the wiki page Containers#Graph-structures. Algorithms and code examples are available on the wiki page Algorithms.

Some code examples

Iterate on reachable vertices in the order of their distances from a source vertex:

#include "melon/algorithm/dijkstra.hpp"
#include "melon/container/static_digraph.hpp"
....
static_digraph graph = ...;
arc_map_t<static_digraph, double> length_map = ...;
vertex_t<static_digraph> s = ...; 

for(auto && [u, dist] : dijkstra(graph, length_map, s)) {
    ...;
}

Iterate over the vertices of each strongly connected component:

#include "melon/algorithm/strongly_connected_components.hpp"
#include "melon/container/static_digraph.hpp"
....
static_digraph graph = ...;
for(auto && component : strongly_connected_components(graph)) {
    for(auto && v : component) {
        ...;
    }
}

melon's People

Contributors

fhamonic avatar pradkrish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pradkrish

melon's Issues

contribute?

Hello, happy to see a graph library using C++20 features. Is it possible to get involved in this project and help out in small ways? Thank you.

Test topological sort

I see that topological sort got no tests. Perhaps that could be my good first contribution. Can you assign this issue to me?

Make melon available in conan center

Hi. Will you submit a conan recipe to conan-center-index? That way I could simply add it to my conanfile. Lemon doesn't compile with recent C++ standards and it seems there aren't viable alternatives with a similar API. Otherwise, please let me know if there are well tested alternatives to Melon/Lemon/Boost that have a nice API and are available in conan.
Thank you.

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.