Further refactoring of different types of graphs and removed unused code