creation of graphs helper