Re: Floyd Warshall



andrea <kerny404@xxxxxxxxx> writes:

In a few words I have to find the minimum distance between many
cities, where
(get-dist c1 c2)
tells me the distance (100 if there are no direct path).

This is the algorithm

(defun floyd-warshall ()
"crea una tabella n*n con le distanze piu brevi fra le citta"
;; primo ciclo imposta i collegamenti diretti fra le citta (k == 0)
;; citta con se stesse

I'm a lisp n00b, but maybe this is good advice.

What I usually do is chop up large functions into much smaller pieces
that can be tested individually in a unit test. I think there are a
few candidates in your code that could be taken out and thus also
tested independently. It is much easier to catch bugs that way and it
is also a good way to build up a library of utility functions and/or
macros.

S.

.