Floyd's Algorithm in Python -


i not sure how implement floyd's algorithm in following program. must print 5x5 array represents graph on page 466 , include counter used print total number of comparisons when algorithm executed - each execution of "if" structure counts 1 comparison.

does know how start program? not sure how begin.

the following purely transcription of pseudocode linked. changed nothing.

for k in range(n):     in range(n):         j in range(n):             if a[i][k]+a[k][j]<a[i][j]:                 a[i][j]=a[i][k]+a[k][j] 

Comments