graph class implemented