GithubHelp home page GithubHelp logo

elzawawy / graph-algorithms Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 4.0 425 KB

A C++ implementation of famous graph-based algorithms.

CMake 2.06% C++ 97.94%
graph-algorithms minimum-spanning-trees shortest-path-algorithm prim-algorithm dijkstra-algorithm dijkstra-shortest-path spanning-trees

graph-algorithms's Introduction

GraphAlgorithms

This repository contains a C++ implementation of some of the Graph Algorithms: Minimum spanning tree (Prim's Algorithm) & Shortest Path Finding (Dijkstra’s Algorithm).

This team (me and @oswidan97) work was developed as assignment for Data Structures & Algorithms Course Spring 2018 offering at CCE department, Faculty of Engineering, Alexandria University.

Overview & goals

  • The main goal is to become familiar with the graph data structure, its algorithms and applications.

  • A Graph is a non-empty finite set V of elements called vertices together with a possibly empty set E of pairs of vertices called edges G(V,E).

  • A weighted graph is a graph, in which each edge has a weight (some real number).

  • Weight of a Graph is the sum of the weights of all edges.

  • A Minimum Spanning Tree in an undirected connected weighted graph is a spanning tree of minimum weight (among all spanning trees). The minimum spanning tree may not be unique. However, if the weights of all the edges are pairwise distinct, it is indeed unique.


Algorithms Implemented

Prim's Algorithm

  • Solves the MST (MInimum Spanning Tree)Problem: Given a connected weighted undirected graph G , design an algorithm that outputs a minimum spanning tree (MST) of G.

  • The Prim’s algorithm makes a nature choice of the cut in each iteration – it grows a single tree and adds a light edge in each iteration.

  • Input: Weighted undirected graph, single source s.

  • Output: Edges (MST) using Prim’s algorithm starting from s to include all vertices.

Dijkstra's Algorithm

  • Solves the Shortest Path Finding Problem: The shortest path between two vertices is a path with the shortest length (weight).

  • In particular, the Dijkstra’s algorithm is a solution to the single-source shortest path problem in graph theory, and solves for both directed and undirected graphs.

  • Constraints:

    • All edges must have nonnegative weights.
    • Graph must be connected.
  • Input: Weighted directed graph with positive edge weights, single source s.

  • Output: the distance of a shortest path from the source vertex to every other vertex in the directed graph using Dijkstra’s algorithm.

References

1. Minimum Spanning Tree (MST) using Prim’s Algorithm Tutorial, Used the figure.

2.A New Hardware Architecture for Parallel Shortest Path Searching Processor Based-on FPGA Technology, Used the figure.


Made with ❤️

graph-algorithms's People

Contributors

oswidan97 avatar

Stargazers

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