Skip to content

Commit 4912a28

Browse files
committed
(prim) fix inverted edge cost calculation
1 parent eacc5bf commit 4912a28

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/spanningTree/prim.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Pgr_prim : public Pgr_mst<G> {
131131
*/
132132
if (u == v) continue;
133133

134-
auto cost = distances[u] - distances[v];
134+
auto cost = distances[v] - distances[u];
135135
auto edge = graph.get_edge(u, v, cost);
136136
this->m_spanning_tree.edges.insert(edge);
137137
}

0 commit comments

Comments
 (0)