Skip to content
Charlotte edited this page Feb 17, 2021 · 3 revisions

Welcome to the heap-experiments wiki! This page goes over some basic usage of the app. You can find more details on the other pages.

Starting the CLI app

This requires Python 3.9, found here. Older versions of Python 3 do not support some of the type hinting used; removing type hinting should make the code compatible with all versions of Python 3.

You first need to give the heap-experiments/app/main.py script permission to execute, and execute it. More information on the project structure.

# Instructions for Linux/Mac
cd ./heap-experiments

chmod 755 ./app/main.py  # you only have to do this once

./app/main.py            # start the app

Generating a test

You should see in your terminal that the heap app has started. Now use the command gen dense to generate a dense graph using the arguments specified by config/dense, it will take a minute to complete. More information on generating tests.

> gen dense
generating...

-----Graph Composition-----
name           dense
vertices       2,500
average degree 800.0
completeness   32.013%
edges          1,000,000
neg weights?   no
acyclic?       no
---------------------------

Running a test

There should now be a graph saved to data/dense. Use the command run bd dense to run Dijkstra's algorithm on the graph using a binary heap (bd = Binary heap Dijkstra). It will take a minute to load the graph into memory, then the algorithm itself finishes very quickly. More information on running tests.

> run bd dense
running...

Binary heap runtime on dense: 1.2182 s

We can see that the runtime was 1.2182 seconds. Not bad! To exit the app, just use the command exit. If you ever get stuck generating or running something, you can terminate the process with Cmd/Ctrl + C or by closing your terminal. Then maybe make your test smaller.

Enjoy!

Clone this wiki locally