You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation of Optimal Floyd Algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles).
The values can be inserted using a matrix ( array of arrays of ints )
'''
inf = 10**10
def floyd(matrix):
matrix_length = len(matrix)
for k in range(matrix_length):
for i in range(matrix_length):
for j in range(matrix_length):
# Negative Weight Cycles are not allowed in Floyd Algorithm