Make method parse_int reusable

Move the method to its own class
gengraph now handles invalid arguments correctly