GithubHelp home page GithubHelp logo

shortest-path-alt-dijkstra's Introduction

Shortest path finder

Compile

In the linux terminal type: ./build.sh
After this to get the list of commands and their uses type: ./alt-dijkstra help
Note you may have to use 'chmod u+x' on build.sh.

Test files

Use the following commands to get the node-, egde- and poi files.
wget https://www.idi.ntnu.no/emner/idatt2101/Astjerne/opg/norden/noder.txt
wget https://www.idi.ntnu.no/emner/idatt2101/Astjerne/opg/norden/kanter.txt
wget https://www.idi.ntnu.no/emner/idatt2101/Astjerne/opg/norden/interessepkt.txt

Implementation of ALT

The ALT algorithm that is used compares the estimated distance from a node to different landmarks. It then chooses the largest estimated distance and uses this in addition to the current travelled distance to decide the priority in the queue. Other than that it is a regular dijkstra algorithm.

ALT Preprocessing

The preprocessing is done on 2 threads and produces 2 files for each landmark.
The landmarks are in this case predefined, you can change them if need to work better with your map.

Implementation of Dijkstra for points of interest

The method to get the points of interest around a node uses dijkstra until 8 nodes have been added to a list of indexes. Node type is checked by using a binary and (&) operation on the current nodes type and checks if it is equal to the node type.

Input Formatting

The program reads txt files for nodes and edges seperately. The format for each is shown below.

Edge input format

      16826594
0 1 792   44   20
1 0 792   44   20
1 2 1926 107 20
2 1 1926 107 20

Node input format

                7509994
0 55.6345298 12.0729630
1 55.6345880 12.0722614
2 55.6346358 12.0705787
3 55.6390613 12.0686169

Point of interest format

            264276
853062   2    "Neste"
2354944 1    "Myrland"
2856553 1    "Ulvvik"
6838135 1    "Salberg"

shortest-path-alt-dijkstra's People

Contributors

callumgran avatar lytixdev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

shortest-path-alt-dijkstra's Issues

Preprocessing for ALT

Create a function for preprocessing with ALT.
An idea for this could be to use multithreading for better performance.

f_next_int() may return garbage values

Using the noder.txt (island) as input with starting node 1 I get a segfault as the from_idx is too large.

    struct edge_t *head = graph->neighbour_list[from_idx];

will segfault because from_idx > length of neighbour_list.

I think the issue is that may f_next_int() returs garbage/uninitialized/random data.

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.