Apparently, my teacher believes that even if we donβt have time to study the material (and there arenβt enough examples), we should move on, so now I need to know how to make the Floyd-Warshall and Warshall algorithms in clisp.
As in the case of the prologue, my task is to generate an adjacency matrix from the graph, in this case it will be a list of lists, for example:
((A B) (A C) (A D) (B C) (C D))
This should generate:
((0 1 1 1) (1 0 1 9) (1 1 0 1) (1 9 1 0))
I have it:
(defun floyd(graph)
(setf l (length graph))
(setf mat (matrix l graph))
)
(defun matrix(l graph)
(setf matrix (make-array (list l l)))
(dotimes (i l)
(dotimes (j l)
(if (= i j)
(setf (aref matrix i j) 0)
(setf (aref matrix i j) ???)
)
)
)
matrix
)
Any help is greatly appreciated.
In addition, and it seems to be off topic: if I could solve my own question, should I answer myself for the answer to the question?
Kirby source
share