Skip to content

iliyafaramarzi/Floyd-Warshall-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Floyd-Warshall algorithm

The Floyd-Waarshall algorithm (also known as the WFI algorithm) is an algorithm for finding the shortest paths between all of the points of a graph. Also, this graph can be a weighted graph with positive or negative vertices (but with no negative cycles).

How Floyd's algorithm work?

First of all you need a graph like Below:
Graph

Then we should make a matrix of paths (i is the start point and j is the finish point); if i equals j, we put 0, if the start point and end point don't have neighbors, we put infinite, and if two points are neighbors, we put the degree of the start point. Look at the below matrix Matrix

And then we have to change the values to the shortest paths.

Contact me

Telegram
Instagram
Linkedin