graph class implement and test