graph and tree traversal algorithm implement.