Giter Site home page Giter Site logo

crimsondevil / routing-table-using-dijkstras Goto Github PK

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

Implementation of Dijkstra's algorithm to build routing tables for nodes in a network.

C++ 97.42% Makefile 2.58%
network routing-tables dijkstra-algorithm shortest-path-routing-algorithm

routing-table-using-dijkstras's Introduction

DIJKSTRA'S

In this project, I have implemented Dijkstra's algorithm to build the routing table of a given source node in the network, which is 0 for this project. Along with this, I have also shown the shortest path tree for each node from node 0.

dijkstras.cpp

This file first reads the data from a text file called Adj.txt from which it gets the number of nodes and its adjacency matrix. It then performs Dijkstra's algorithm using this adjacency matrix and outputs the cost to reach each node and its next hop. After this, the shortest path tree for each node from 0 is also shown. The path is shown according to the node number rather than sequence of the node followed by the path to reach the destination node.

Adj.txt

This file contains the number of nodes in the first line and the adjacency matrix for the all the nodes in the network, separated by a newline(\n).

Sample Output

Routing Table of node 0

Destination Cost Next-Hop

    1       2       1        
    2       1       2        
    3       3       2        
    4       2       2       
    5       4       2

Minimum Path Tree: (from 0 to each node, sequenced numerically)

0 1
0 2
0 2 4 3
0 2 4
0 2 4 5

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.