How mgold/fibonacci-heap works
Purpose and entry point
This is a C benchmark/implementation project comparing a Fibonacci heap with a naive array-based heap. main.c is the executable entry point; heap selection is compile-time controlled through use.h.
Heap abstraction boundary
heap.h defines the common heap-facing interface used by the driver, allowing main.c to operate independently of the chosen implementation. use.h selects and exposes either the Fibonacci or naive implementation.
Paths: heap.h, use.h, main.c
Fibonacci heap implementation
The primary data structure is implemented in fiboHeap.c. It provides Fibonacci-heap operations, including minimum removal and the amortized-efficient insertion, merge, and decrease-key behavior described by the project.
Paths: fiboHeap.c, heap.h
Node representation
Heap elements and Fibonacci heap tree/list links are represented separately from heap operations in node.c and node.h. This is the structural boundary for node allocation and pointer-based relationships used by the Fibonacci heap.
Paths: node.c, node.h, fiboHeap.c
Naive comparison implementation
naiveHeap.c provides the alternative array-based heap used as the performance baseline. It is selected through the same interface/configuration path as the Fibonacci heap.
Paths: naiveHeap.c, heap.h, use.h
Execution and measurement flow
The driver in main.c invokes the selected heap API, exercises heap operations, and emits benchmark data to plotData.txt. The supplied compile and test.sh support building/running this C program, but the core runtime is a native compiled executable with no service dependencies.
Paths: main.c, plotData.txt, compile
Reporting pipeline
Benchmark output is consumed by the Gnuplot script plots.p; the academic report source in README.tex incorporates the generated plots. The documented reporting workflow depends on Gnuplot and LaTeX/PDFLaTeX, separate from the heap executable itself.
Paths: plotData.txt, plots.p, README.tex
Main entry points: use.h Implementation selector · main.c Benchmark driver · fiboHeap.c Fibonacci heap · heap.h Heap interface
Components 11
Benchmark runtime
- Build script · Builds the native benchmark executable.
compile - Benchmark driver · Exercises the selected heap and emits measurements.
main.c - Implementation selector · Exposes the chosen heap implementation.
use.h - Heap interface · Common heap-facing interface for the driver.
heap.h
Heap implementations
- Fibonacci heap · Supports amortized-efficient insert, merge, decrease-key, and min removal.
fiboHeap.c - Heap node model · Defines node structure and pointer relationships.
node.h - Node operations · Allocates and manages Fibonacci heap nodes.
node.c - Naive array heap · Array-based performance baseline.
naiveHeap.c
Reporting pipeline
- Benchmark data
plotData.txt - Gnuplot script · Turns benchmark data into plots.
plots.p - Academic report · Incorporates generated benchmark plots.
README.tex
Connections 12
- Build script → Benchmark driver: builds
- Benchmark driver → Implementation selector: includes
- Implementation selector → Heap interface: exposes
- Implementation selector → Fibonacci heap: selects
- Implementation selector → Naive array heap: selects
- Fibonacci heap → Heap interface: implements
- Naive array heap → Heap interface: implements
- Fibonacci heap → Heap node model: uses
- Node operations → Heap node model: implements
- Benchmark driver → Benchmark data: writes
- Benchmark data → Gnuplot script: input
- Gnuplot script → Academic report: generated plots