Added the graph construction to improvement algorithm