0

have an implementation of BFS I got elsewhere and modified slightly, but I am having problems with its input.

It takes a graph, and will take it as '((a b c) (b c) (c d)) But my input I am giving it is a weighted graph... I know it's not useful for the BFS, but I use the weights farther down the line later. This input looks like

'(

(a (b 3) (c 1))

(b (a 3) (d 1))

(c (a 1) (d2) (e 2))

)

And so on.

My Code:

```
(defun shortest-path (start end net)
(BFS end (list (list start)) net))
(defun BFS (end queue net)
(if (null queue)
nil
(expand-queue end (car queue) (cdr queue) net)))
(defun expand-queue (end path queue net)
(let ((node (car path)))
(if (eql node end)
(reverse path)
(BFS end (append queue (new-paths path node net)) net)
)
))
(defun new-paths (path node net)
(mapcar #'(lambda (n)
(cons n path))
(cdr (assoc node net))))
```

I'm just not sure where I need to most likely modify it to accept the new style list, or make a help function to format it correctly?