Skip to content

A simple NodeJS implementation of the Distance-vector routing protocol which uses the Bellman-Ford algorithm.

Notifications You must be signed in to change notification settings

cd5b1e4947e304476c788cd474fb579a/distance-vector-routing-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

distance-vector-routing-algorithm

A simple NodeJS implementation of the Distance-vector routing protocol which uses the Bellman-Ford algorithm.

Required dependencies

npm i cli-table and npm i colors

Graph input file

Create any file with extension .bf and enter graph data accordingly.

(Example pulled from provided Wikipedia article)

Graph

Given graph would be translated as such into filename.bf:

1-3 2-23
0-3 2-2
0-23 1-2 3-5
2-5

The graph file format for a graph with N vertices is:

A's edges
B's edges
...
N's edges

with each edge being defined as TO-COST. Edge from A (0) to C (2) with cost of 23 would be in line 1 (0) as 2-23

Output

The program will output each step, from the initialization of each vertices table, to the last iteration step where data is being propagated and newer, shorter values are being found.

Notice

  • This program was made to simulate/solve the process for graphs that will correctly terminate after a finite amount of steps and was not made to be robust for other cases.
  • Keep in mind that some places (such as the Wikipedia article) have inverted tables compared to this programs output. (to/via <-> via/to)

How to run

node bford filename

About

A simple NodeJS implementation of the Distance-vector routing protocol which uses the Bellman-Ford algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published