Created a class for graph