finalizing code using graph implementation, wrapper to collect the statistics and generate graph remains