graph exercises in Cpp