F# Priority Queue

Viewed 760

I have tried to use this snippet of code

https://code.msdn.microsoft.com/windowsdesktop/Net-Implementation-of-a-d3ac7b9d

to implement a heap-based implementation of Prim's algorithm to solve the Minimum Spanning Tree (MST) problem in a non-directed connected graph.

after a few iterations, i find that the heap/priority queue is not well maintained anymore. that is the head of the PriorityQueue doesn't have the lowest Key in the Heap.

PQ 0 [-7230, 309]
...
PQ 146 [-7277, 308]

Has anyone use this code and experienced similar problems ? I can post a link on GitHub if anyone would be looking at it

My needs are for a heap datastructure which supports deletion of an element in the middle. It looks like Fsharpx.collections doesnt have such a data structure.

does anybody know a good implementation available somewhere ?

thanks

2 Answers
Related