implemented all 3 different types of graphs