From 5d8e011782fe016bedc936fd61a544c4b0ba738e Mon Sep 17 00:00:00 2001 From: bo-tato <122528427+bo-tato@users.noreply.github.com> Date: Thu, 18 Jan 2024 23:48:59 +0000 Subject: [PATCH] fix bug in min-cut caused by mutation from sort --- graph.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph.lisp b/graph.lisp index 97ff5d2..42becb1 100644 --- a/graph.lisp +++ b/graph.lisp @@ -1275,7 +1275,7 @@ through to guide the A* search used in `shortest-path'.") (rest (remove (car a) (nodes g)))) (loop :while rest :do ;; grow A by adding the node most tightly connected to A - (let ((new (car (sort rest #'> :key {connection-weight a})))) + (let ((new (extremum rest #'> :key {connection-weight a}))) (setf rest (remove new rest)) (push new a))) ;; store the cut-of-phase