Implemented graph logic