visualizations

Programmatic visualizations
git clone git://git.laack.co/visualizations.git
Log | Files | Refs | README

commit 7b9a6d0e77c4522533d6d632269990172323df0e
parent 3c74e26e8bea5cbbc465f76b88ea5c5c75e9f8dc
Author: Andrew Laack <andrew@laack.co>
Date:   Tue, 15 Sep 2026 23:37:22 -0500

Allow seconds from the cli + cleanup

Diffstat:
M.gitignore | 1+
Mbackground/Makefile | 6+++---
Dbackground/background | 0
Mbackground/headers/constants.hpp | 1+
Mbackground/src/main.cpp | 10+++++++++-
5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +background.out diff --git a/background/Makefile b/background/Makefile @@ -1,9 +1,9 @@ build: - g++ -Ofast src/main.cpp src/prim.cpp src/graph.cpp src/edge.cpp src/utils.cpp src/vertex.cpp src/background.cpp -lraylib -lX11 -o background + g++ -Ofast src/main.cpp src/prim.cpp src/graph.cpp src/edge.cpp src/utils.cpp src/vertex.cpp src/background.cpp -lraylib -lX11 -o background.out install: build - cp background /usr/local/bin + cp background.out /usr/local/bin/background clean: - rm background + rm background.out test: g++ tests/graph_test.cpp src/prim.cpp src/graph.cpp src/edge.cpp src/utils.cpp src/vertex.cpp src/background.cpp -lCatch2Main -lCatch2 -lraylib -lX11 -o graph_tests ./graph_tests diff --git a/background/background b/background/background Binary files differ. diff --git a/background/headers/constants.hpp b/background/headers/constants.hpp @@ -7,3 +7,4 @@ const float VERTEX_RENDER_SIZE = 4; const float EDGE_REDNER_SIZE = 1; const std::size_t DEFAULT_EDGE_COUNT = 1000; const std::size_t DEFAULT_VERTEX_COUNT = 200; +const float DEFAULT_SLEEP_TIME = 1; diff --git a/background/src/main.cpp b/background/src/main.cpp @@ -6,6 +6,7 @@ #include <cstddef> #include <cstdint> #include <cstdlib> +#include <iostream> #include <unistd.h> #include <raylib.h> #include <ctime> @@ -23,6 +24,12 @@ int main(int argc, char** argv) { .default_value(DEFAULT_VERTEX_COUNT) .scan<'i', std::size_t>(); + program.add_argument("--sleep", "-s") + .help("amount of time to sleep between traversals") + .default_value(DEFAULT_SLEEP_TIME) + .scan<'g', float>(); + + program.add_argument("--edges", "-e") .help("number of edges in the graph") .default_value(DEFAULT_EDGE_COUNT) @@ -39,6 +46,7 @@ int main(int argc, char** argv) { std::size_t vertexCount = program.get<std::size_t>("--vertices"); std::size_t edgeCount = program.get<std::size_t>("--edges"); + float sleepTime = program.get<float>("--sleep"); SetTraceLogLevel(LOG_ERROR); @@ -72,7 +80,7 @@ int main(int argc, char** argv) { ClearBackground(BLACK); g.render(); EndDrawing(); - sleep(1); + usleep((int)sleepTime * 1000000); oneStepPrim(toVisit, visitedIndices, g); } }