From 16f4f82ad9868a9168ad92a130601248a92be147 Mon Sep 17 00:00:00 2001 From: Dmitry Bubelnik <74250088+DmitryBubelnikSoftSmile@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:17:05 +0300 Subject: [PATCH] Fix incorrect distance calculation for ComputeDense (#41) --- core/DijkstraGraphDistance.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/DijkstraGraphDistance.cs b/core/DijkstraGraphDistance.cs index f06023f4..540f69c7 100644 --- a/core/DijkstraGraphDistance.cs +++ b/core/DijkstraGraphDistance.cs @@ -225,6 +225,7 @@ protected void Compute_Dense() { while (DenseQueue.Count > 0) { float idx_priority = DenseQueue.FirstPriority; + max_value = Math.Max(idx_priority, max_value); int idx = DenseQueue.Dequeue(); GraphNodeStruct g = DenseNodes[idx]; g.frozen = true; @@ -232,7 +233,6 @@ protected void Compute_Dense() order.Add(g.id); g.distance = max_value; DenseNodes[idx] = g; - max_value = Math.Max(idx_priority, max_value); update_neighbours_dense(g.id); } } @@ -584,4 +584,4 @@ void update_neighbours_dense(int parent_id) } -} +} \ No newline at end of file