Coder Social home page Coder Social logo

memergamer / graphtheory Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 178 KB

In this repository there are graph theory exercises for my University.

License: GNU General Public License v3.0

CMake 1.23% C++ 49.85% C 1.47% Python 41.55% TypeScript 5.90%
cpp graph-algorithms graph-theory-algorithms python sapientia-university typescript

graphtheory's Introduction

Graph Theory Algorithms

This repository contains implementations of various graph theory algorithms. These algorithms are commonly taught in university courses and can be used to solve a variety of problems related to graphs.

Algorithms and Programming Languages

If a box is checked, the algorithm has been implemented in that language.

Algorithm C++ Python TypeScript Rust Go Zig V Java Kotlin C# Ruby
Breadth-First Search (BFS) ✔️ ✔️ ✔️
Depth-First Search (DFS) ✔️ ✔️
Prufer Encode & Decode ✔️ ✔️
Check if a Graph is Bipartite (Colorable) ✔️ ✔️
Articulation Points (or Cut Vertices) in a Graph ✔️ ✔️
Bridge detection algorithm ✔️ ✔️
Kruskal's Minimum Spanning Tree Algorithm ✔️ ✔️
Prim's Minimum Spanning Tree Algorithm ✔️ ✔️
Dijkstra's Shortest Path Algorithm ✔️ ✔️
Bellman-Ford Algorithm ✔️ ✔️
Ford Fulkerson Algorithm ✔️ ✔️
Floyd-Warshall Algorithm ✔️ ✔️

Getting Started

To use these algorithms, you'll need to have a basic understanding of graph theory and programming in either C++ or Python. Each algorithm is contained in its own folder and the corresponding files and can be run independently.

Prerequisites

To run the C++ implementations, you'll need a C++ compiler installed on your system. The code has been tested with g++ on Linux. To run the Python implementations, you'll need Python 3 installed.

Installing

To use these algorithms, simply clone this repository to your local machine:

git clone https://github.com/MemerGamer/GraphTheory.git

Usage

Each algorithm is contained in its own folder and file and can be run independently. To use an algorithm, simply navigate to the corresponding folder and files and run it using the appropriate command for your language.

There are also tests for each algorithm, these are automatically run if you run the main.cpp file in the root directory for C++ or the main.py file in the root directory for Python.

Tests

Algorithm C++ Python Input file
BFS 0.000040 seconds 0.000153 seconds default-input-04.txt
DFS 0.000065 seconds 0.000182 seconds default-input-04.txt
Prufer 0.000100 seconds 0.000203 seconds default-input-06.txt
Bipartite 0.000059 seconds 0.000167 seconds default-input-07.txt
Articulation Points 0.000098 seconds 0.000217 seconds default-input-08.txt
Bridges 0.000064 seconds 0.000176 seconds default-input-10.txt
Kruskal 0.000176 seconds 0.000525 seconds weighted-input-09.txt
Prim 0.000525 seconds 0.000529 seconds weighted-input-09.txt
Dijkstra 0.000221 seconds 0.000604 seconds weighted-input-09.txt
Bellman-Ford 0.000326 seconds 0.000965 seconds weighted-input-09.txt
Ford-Fulkerson 0.000104 seconds 0.000219 seconds source-drain-input-01.txt
Floyd-Warshall 0.000083 seconds 0.000225 seconds weighted-input-12.txt

The test were run on an Asus Vivobook Pro 15 with an Intel® Core™ i5-7300HQ × 4 processor and 16GB of RAM on Fedora 38. The results may vary depending on your system.

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.