Re: Floyd Warshall
- From: Stefan Arentz <stefan.arentz@xxxxxxxxx>
- Date: 30 Aug 2007 10:30:50 +0200
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.
.
- Follow-Ups:
- Re: Floyd Warshall
- From: andrea
- Re: Floyd Warshall
- References:
- Floyd Warshall
- From: andrea
- Floyd Warshall
- Prev by Date: Re: Floyd Warshall
- Next by Date: Re: ANN: ABLE 0.4
- Previous by thread: Re: Floyd Warshall
- Next by thread: Re: Floyd Warshall
- Index(es):