TODO: implement graph class