use boost graph library to handle dependency and shared_ptr to avoid memory leak due to throwing exception in constructor