Dijkstra's algorithm: Difference between revisions
Content deleted Content added
Line 1,374: | Line 1,374: | ||
</lang> |
</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</pre> |
|||
<lang lisp> |
<lang lisp> |
||
(defvar *r* nil) |
(defvar *r* nil) |
||
Line 1,401: | Line 1,404: | ||
(defun nodes (c w) |
(defun nodes (c w) |
||
(sort (cdr (assoc c w)) #'< :key #'cddr)) |
(sort (cdr (assoc c w)) #'< :key #'cddr)) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</lang> |
</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
> (dijkstra-short-paths |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Path: (A B) Distance: 7 |
Path: (A B) Distance: 7 |
||
Path: (A C) Distance: 9 |
Path: (A C) Distance: 9 |