Heap - F Priority Queue

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have tried to use this snippet of code

https://code.msdn.microsoft.com/windowsdesktop/Net-Implementation-of-a-d3ac7b9d 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

Answers

https://github.com/Spreads/Spreads/blob/master/src/Spreads.Collections/Common/FixedMinHeap.fs https://github.com/Spreads/Spreads/blob/master/src/Spreads.Collections/Common/FixedMinHeap.fs

https://github.com/Spreads/Spreads/blob/master/tests/Spreads.Collections.Tests/Cursors/ZipNTests.cs#L771 https://github.com/Spreads/Spreads/blob/master/tests/Spreads.Collections.Tests/Cursors/ZipNTests.cs#L771

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/36193322/f-priority-queue

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils