File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
alpha/alpha-algo/src/main/java/org/neo4j/gds/impl/spanningtree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,12 @@ private SpanningTree growApproach(SpanningTree spanningTree) {
281281 }
282282 }
283283 if (affectedNode != -1 ) { //if a node has been converted to a leaf
284- toTrim .add (affectedNode , affectedCost ); //add it to pq
284+ if (!toTrim .containsElement (affectedNode )) {
285+ toTrim .add (affectedNode , affectedCost ); //add it to pq
286+ } else {
287+ //it is still in the queue, but it is not a leaf anymore, so it's value is obsolete
288+ toTrim .set (affectedNode , affectedCost );
289+ }
285290 exterior .set (affectedNode ); //and mark it in the exterior
286291 }
287292 } else {
@@ -373,7 +378,7 @@ private SpanningTree combineApproach(SpanningTree tree) {
373378 }
374379 var spanningTree1 = cutLeafApproach (tree );
375380 var spanningTree2 = growApproach (tree );
376-
381+ System . out . println ( "Prune Leaf: " + spanningTree1 . totalWeight () + " Grow Mst:" + spanningTree2 . totalWeight ());
377382 if (spanningTree1 .totalWeight () > spanningTree2 .totalWeight ()) {
378383 return (minMax == Prim .MAX_OPERATOR ) ? spanningTree1 : spanningTree2 ;
379384 } else {
You can’t perform that action at this time.
0 commit comments