CSRT-NTUA / AlgoPlus

AlgoPlus is a C++17 library for complex data structures and algorithms
https://csrt-ntua.github.io/AlgoPlus
Apache License 2.0
141 stars 20 forks source link
algorithms algorithms-and-data-structures algorithms-interview-questions computer-science cpp data-structures-and-algorithms graph-algorithms image-processing implementation-from-scratch implementation-of-algorithms implementation-of-data-structures interview-preparation interview-questions linked-list machine-learning machine-learning-algorithms machinelearning mathematics tree tree-algorithms

Algoplus{BETA Version}

AlgoPlus is a C++ library that includes ready-to-use complex data structures and algorithms.

Algoplus

Gitpod Ready-to-Code CodeQL CI codecov GitHub repo size

See the full documentation here

Join our Discord

Example:

#include <machine_learning/clustering/kmeans/kmeans.h>

// AlgoPlus now has Machine Learning classes!
int main(){
    std::vector<std::vector<double> > data;
    int CLUSTERS;
    kmeans a(data, CLUSTERS);
    ...
    // returns the cluster centers and assignments of the kmeans clustering
    std::pair<std::vector<std::vector<double> >, std::map<std::vector<double>, int64_t> > ans = a.fit();
}

#include <machine_learning/image/edge_detection/sobel_operator.h>

// As well as image processing algorithms!
int main(){
  ...
  std::vector<std::vector<int32_t> > img(data);

  // Performs edge detection on image img
  std::vector<std::vector<int32_t> > resulted = Sobel(img);
  ...
}

#include <graph.h>

// And of course, every data structure that you need!
int main(){
  weighted_graph<int> g("undirected");
  g.add_edge(1, 4, 2);
  g.add_edge(4, 5, 6);
  g.add_edge(5, 2, 9);
  g.add_edge(2, 8, 10);

  // returns the shortest path from 1 to 2.
  std::cout << g.shortest_path(1, 2) << '\n';
  g.visualize() // You can visualize almost any of our implemented data structures!
}

You can see more examples or follow the Tutorials.

Classes

Graphs

Trees

Lists

Other

Machine Learning(NEW!)

How to run test cases

We have unit tests for every function of our implemented algorithms & data structures.It is very important to make sure that your code works before making any pull requests!

Linux/MacOS

mkdir build && cd build
cmake ..
make
cd tests
./runUnitTests

Windows

mkdir build && cd build
cmake -G "MinGW Makefiles" ..
make
cd tests
./runUnitTests

Our contributors

How to contribute

  1. Povide new implementations on our already implemented data structures & algorithms.

  2. Implement new classes / algorithms.

  3. Contribute to unit testing by writting unit tests for our classes and algorithms.

  4. Create and contribute to APIs for other languages.

  5. Promote the repository on your local workshop/seminar and get a shout-out.

See more here.

Star History

Star History Chart