急!求大神解,c++用graph应该怎么解决这个问题呀

RT,c++用graph应该怎么解决这个问题呀图片说明

https://blog.csdn.net/manonghouyiming/article/details/79515989