Hi, CodeForces!
For the past 2 months I have been working on a Graph Debugging tool, which allows you to draw graphs like these with just TWO lines of code:
This is similar to print debugging (when you got a crash somewhere, so you repeatedly recompile the code with cout << "penis\n";
to see where it failed), but instead it creates a window with the graph, which you can change however you want.
It is also a marginally better tool than graph editor from CSAcademy in my opinion, so I would love you guys to try it out.
This is not compatible with MacOS because Apple deprecated OpenGL (and even if it wasn't, it would've been kinda annoying to use)
Building
First, build the code from the repo:
https://github.com/EnDeRGeaT/graph-debugger
If you write in Visual Studio (not Visual Studio Code), follow "For MSVC" part.
If you write in anything else, you probably should follow "For GCC/Clang".
Having competitive programming in mind, I suggest you to not really bother and copy .a (or .lib) files in your compiler's library folder. You can do the same thing with include files, however I chose a different path.
Using
Almost everything is written in github page, but anyway.
You can create a Graph from a list of edges:
Or you can create a Graph from your adjacency list:
Or you can create it if it's a C array:
if your representation is 1-indexed, you can add a part of it!
Weighted graph? Not a problem!
And the list goes on!
To get help in moving around in the actual window, just press H. Hints will be outputted in a console (via std::cerr)
You can also create multiple instances of Graph class, and move between them with left/right arrow.
Very important note: visualize()
DOES NOT STOP THE EXECUTION. Hence your main code can continue working. It will stop the execution when the last Graph instance is about to get destroyed (and will write so in the console).
There are also ways to visualize with highlighted edges, and there are some basic algos in this graph (they are bad because i was writing them for my discrete math assignments). But that is not that important point for use.
Another important node: In order to not rewrite any code (which kinda defeats the point of this tool), it does everything in a different thread, which is not very correct to do. So, if you have any issues (like window hanging, or a crash), see Issues in the github repo.
Caveats
Graph drawing is hard. Really. I didn't know what I got myself into 2 months ago.
Here are some issues with it:
- Directed graphs are not really supported (it is not that hard to add support though)
- Self-loops are also not supported (it is also kinda hard to add support for it. Multi edges are supported though!)
- Prettifier for the graph is not very good, it is giga slow, and also ugly for dense graphs. If you want, you can help me with writing a better one.
Future
This was my first project that didn't involve competitive programming and it was very hard. Since it is my first project, the code quality is also very subpar! The library can be riddled with bugs due to it.
I can maintain it for some time, but it all depends on whether CP community will like what I did.
So, I hope you guys like this tool, you can ask any questions here :)
Auto comment: topic has been updated by EnDeRBeaT (previous revision, new revision, compare).
Hello i'm sorry.I don't know how to use it .
I downloaded the file and tried to include it but it returned "no such file or directory".
Can you please help.
Hi, your image is unfortunately broken. Can you tell what do you use for coding, so that I can try to help you?
https://imgur.com/a/dzkNubL
The reason it can't see the header is because it is in graph-debugger-master/.. folder.
I suggest you taking include library out of the folder and paste directly in the workspace (so you will have include folder and a.cpp b.cpp...). So in that case you will also have to make it
#include "include/GraphDebugger.h"
By the way I see that you didn't really follow the guide in repository, I highly advise you to build the library(it is also just pasting a single piece of code in console!), unless you use CMake to build your programs with.
bro how to build the library i didn t get it , m windows user
good job, bro!
Друзья, кто-нибудь проверял работу на маке с arm чипом?
Уже понял...
looks very good even at entry level. wishing you success in development.
Yo the idea behind this tool is so cool and useful
OTZ
EnDeRBeaT orz
Thanks for helping the community
how to download it for windows ?
Which compiler do you use for competitive programming?
g++
Make sure you have git and cmake installed (you can check it by writing git --version and cmake --version in your console)
After that you can just copypaste the commands in repository in you console (these with git clone and cmake unix makefiles). There is a button that copies it for your in the up right corner.
Sometimes it doesn't execute the last line, so if it doesn't say "building" anywhere, just write
make
in the console.After that you will have libraries in folders that are mentioned in repo, so you can proceed with the instructions in repository.
I am sorry, it is a rather convoluted process, but there's no good package manager for C++ (there's CMake, and you can use this tool easily with CMake, but hardly anyone uses it for competitive programming)
i got this error CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.
Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!
It seems like you don't have make installed. Check with
make --version
You might have installed g++ with msys2, so in that case make is named as
mingw32-make
I think msys2 ships with Ninja on default, so you can run the following command:
cmake --fresh -G "Ninja" ..
Then, write
make
ormingw32-make
mingw32-make -G "Unix Makefiles" ..
i typed this but it shows me there is no option ( -G )mingw32-make: invalid option -- G
Run this:
cmake --fresh -G "Ninja" ..
mingw32-make
C:\Users\YS\graph-debugger\build>mingw32-make "Unix Makefiles" .. mingw32-make: *** No rule to make target 'Unix Makefiles'. Stop.
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.
Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!
Did you run
cmake --fresh -G "Ninja"
?yes it dosen t run also