Implement preparation code for Chapter4, tree and graphs