implemeted the check of acyclicity + the interface of the graph class