implementation of graphs