Second refactor: visualize any graph by calling the 'visualize' function with a graph as an argument