Skip to content

AissamDjahnine/Dijkstra

Repository files navigation

Dijkstra Metro-Problem-

Implementation of Dijkstra's algorithm to compute the shortest path on Paris subway network 🚉 --> 🚋 --> 🚉

Related Work

You can find a python-based implementation for the same database here : https://github.com/IemProg/ParisPathFinder.

Getting Started & Prerequisites

Step #1: Install C/C++ compiler and related tools

If you are using Fedora, Red Hat, CentOS, or Scientific Linux, use the following yum command to install GNU c/c++ compiler:

       yum groupinstall 'Development Tools'

If you are using Debian or Ubuntu Linux, type the following apt-get command to install GNU c/c++ compiler:

       $ sudo apt-get update
       $ sudo apt-get install build-essential manpages-dev

Step #2: Verify installation

Type the following command to display the version number and location of the compiler on Linux:

       $ whereis gcc
       $ which gcc
       $ gcc --version

Running

  • Using of compilerflags 🏁 :

    -Wall -Wextra -Werror -pedantic -pedantic -errors -O3
    

of g++ to garanteeC++ norms in the code implementation, optimizing compiling.

  • Using C++ 11 by adding the compilerflag 🏁 :

    std=c++11 
    
  • Dynamic memory using STL containers

Execution & tests

Use of the csv files as database :

In order to execute the code , two csv files 📄 are provided as database :

s.csv : contains all the stations of paris subway :

alt text

c.csv : contains all the connections between the subway stations ( transfer time in seconds )

alt text

Use the makefile to compile the cpp files :

Example :

alt text

You can check the makefile ☑️

Execute the program :

There are two ways to excute the Network program :

1/ Using Stations Ids :

You can find the 🆔 of the stations in : s.csv file

    ./Network s.csv c.csv Start_id End_id        

Example :

     ./Network s.csv c.csv 1722 2062

Output :

alt text

2/ Using Stations Names :

You can find the names 🔡 of stations in : s.csv file

Note : the code is resistant to spelling errors ⚠️ ( Using the levenshtein Distance - Check the code -)

    ./Network s.csv c.csv Start_name End_name

Example :

    ./Network s.csv c.csv Bastille Jussieu        

Output :

alt text

Authors

About

Application of Dijkstra's algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published