EnDeRBeaT's blog

By EnDeRBeaT, 2 days ago, In English

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:

Code

Or you can create a Graph from your adjacency list:

Code

Or you can create it if it's a C array:

Code

if your representation is 1-indexed, you can add a part of it!

Code

Weighted graph? Not a problem!

Code

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 :)

Full text and comments »

  • Vote: I like it
  • +197
  • Vote: I do not like it

By EnDeRBeaT, history, 10 months ago, In English

Codeforces Round #880 has just finished, and here are the first solvers of problem E in div2 and div1 respectfully:

This guy stands right next to Um_nik, his name translates to "I've hung out with Um_nik's wife", and he's cyan(as we know, a 1/1000 of Um_nik).

This was my first div1 contest, I proudly solved 1 problem, and was sad about it, but such a great coincidence has elevated my mood significantly.

Full text and comments »

  • Vote: I like it
  • +363
  • Vote: I do not like it

By EnDeRBeaT, history, 18 months ago, In English

Hello, today in CodeTON round #3, one of the most epic moments in cf history has happened. It's about tourist.

Did he finally cross 4000 rating? No.

Today, he got owned by his archenemy, python gigachad conqueror_of_tourist.

Congratulations to conqueror_of_tourist. Good job, king!

Full text and comments »

  • Vote: I like it
  • +265
  • Vote: I do not like it