input_handler, when it goes out of scope, calls the destructor of the graph that was passed to it due to the graph going out of scope. This is unwanted behavior, because I want the graphs to be reusable so you can try multiple algorithms on the same graph for convenience.