最近在看算法导论的最大流章节,习题 26.1-6 是这样的: Professor Adam has two children who, unfortunately, dislike each other. The problem is so severe that not only do they refuse to walk to school together, but in fact each one refuses to walk on any block that the other child has stepped on that day. The children have no problem with their paths crossing at a corner. Fortunately both the professor’s house and the school are on corners, but beyond that he is not sure if it is going to be possible to send both of his children to the same school. The professor has a map of his town. Show how to formulate the problem of determining whether both his children can go to the same school as a maximum-flow problem.
解答是这样的: Use the map to create a graph where vertices represent street intersections and edges represent streets. Define c(u; v) = 1 for all edges (u; v). Since a street can be traversed, start off by creating a directed edge in each direction, then make the transformation to a flow problem with no antiparallel edges as described in the section. Make the home the source and the school the sink. If there exist at least two distinct paths from source to sink then the flow will be at least 2 because we could assign f(u; v) = 1 for each of those edges. However, if there is at most one distinct path from source to sink then there must exist a bridge edge (u; v) whose removal would disconnect s from t. Since c(u; v) = 1, the flow into u is at most 1. We may assume there are no edges into s or out from t, since it doesn’t make sense to return home or leave school. By flow conservation, this implies that f = Pv2V f(s; v) ≤ 1. Thus, determining the maximum flow tells the Professor whether or not his children can go to the same school.
解答中的这句“However, if there is at most one distinct path from source to sink then there must exist a bridge edge (u; v) whose removal would disconnect s from t.”似乎用了这个结论:如果 a 到 b 是连通的且任意两条 a 到 b 的路径都有重叠的边,那么存在一条边 e,如果删掉 e 会导致 a 和 b 不连通了。 想了好久还没有证明出来,网上也没找到相关内容。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.