Giter Site home page Giter Site logo

bellman-ford-algorithm's Introduction

Bellman-Ford-Algorithm

A Bellman Ford algorithm implementation in Java.

How to use it

You must edit /input/nodes.txt and /input/edges.txt files.

The first one contains a list of all nodes (one per line) in the graph and the first one is the starting node. Example:

a
b
c
d
e
f

In this case the graph is composed by 6 nodes and A is the initial node.

The second one contains a list of edges in the graph, but there mustn't be duplicates. Example:

a,b,7,5
a,c,8,*
b,d,4,-
...
start node, end node, weight start to end, weight end to start / * (the same) / - (NOT connected)

The difference is in the last piece of the line which must be compiled following these rules:

  • A to B weights 7, B to A weight 5;
  • A to C weights 8, C to A weights the same (8);
  • B to D weights 4, D and B are NOT connected.

Output

When you run the program it creates an /output/result.txt file which cointains the routing table of the first node in /input/nodes.txt file. Example:

Node	Distance	Predecessor
a	0.0		me
b	7.0		a
c	6.0		e
d	10.0		e
e	8.0		b
f	8.0		c

bellman-ford-algorithm's People

Contributors

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