add toString method for graph