My first problem is to generate the adjacency matrix from the graph, in this case it would be a list of lists, e.g.:
That should generate:((A B) (A C) (A D) (B C) (C D))
Code: Select all
((0 1 1 1) (1 0 1 9) (1 1 0 1) (1 9 1 0))
Code: Select all
(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)
PS: I've been told I should have been using let instead of setf to declare variables, but I don't know how to use it (I investigated but can't make matrix function work with let ;__;). I hate when there's a class in school and they teach you wrong u__u