graph logic