算法 习题8.22 题解

Problem

In task scheduling, it is common to use a graphrepresentation with a node for each task and a directed edge from task ito task j if i is a precondition for j. This directedgraph depicts the precedence constraints in the scheduling problem. Clearly, aschedule is possible if and only if the graph is acyclic; if it isn’t, we’dlike to identify the smallest number of constraints that must be dropped so asto make it acyclic. 

Given a directed graph G = (V, E), a subset E'E is called a feedbackarc set if the removal of edges E' renders G acyclic. 

FEEDBACK ARC SET (FAS): Given a directed graph G = (V,E) and a budget b, find a feedback arc set of ≤ b edges, ifone exists.

(a) Show that FAS is in NP.

FAS can be shown to be NP-complete by areduction from VERTEX COVER. Given an instance ( G, b) of VERTEXCOVER, where G is an undirected graph and we want a vertex cover of size≤ b, we construct a instance ( G', b) of FAS as follows. If G = ( V, E) has n vertices v1, ..., vn, then make G'= ( V', E') a directed graph with 2n vertices w1, w1', ..., wn,wn', and n + 2| E|(directed) edges:

·        (wi, wi')for all i = 1, 2, ..., n.

·        (wi', wj)and (wj', wi) for every (vi, vj) ∈ E

(b) Show that if G contains a vertex cover of sizeb, then G' contains a feedback arc set of size b.

(c) Show that if G' contains a feedback arc set ofsize b, then G contains a vertex cover of size(at most) b.(Hint: given a feedback arc set of size b in G', you mayneed to first modify it slightly to obtain another one which is of a moreconvenient form, but is of the same size or smaller. Then, argue that Gmust contain a vertex cover of the same size as the modified feedback arc set).


Solution

(a) 对于该问题来说, 如果存在一个解, 那么从图G中移除若干条边, 并验证其无环显然是一个需要多项式时间的过程, 因此FAS属于NP。

(b) 首先回顾一下顶点覆盖的概念:


顶点覆盖

对于图G = (V, E), 对于任意点iV, 我们记Si 为点i所有相连的边的集合。

要求从S1, ..., Sm(m= |V|)中选出b个集合, 使它们的并为E。

b个集合就被称为图 G的一个规模为 b的顶点覆盖。


根据题目提示, 设G的一个大小为b的顶点覆盖为C, 对于任意顶点vi ∈C, 设其在图G' = (V', E')中相对应的顶点为wiwi'. 初始化一个空的边集E'', 将(wi,wi')加入E''. 对C中的每个顶点都这样处理后, 得到的边集E''就是G’一个规模为b的FAS. 因为对于顶点wi, 去掉边(wi, wi')后, wi就不存在任何出边(出度为0), 故与其相连的边也不可能位于任何一个环中;而对于顶点wi', 去掉边(wi, wi')后, wi'就不存在任何入边(入度为0), 故与其相连的边也不可能位于任何环中. 命题得证。


(c) 根据题目提示, 对于图G中的任意一条边(vi, vj), 设它的两个顶点在图G'中对应的顶点为wi, wi', wj, wj', G'中对应的边为(wi, wj'), (wi', wj), (wj, wi'),(wj', wi). 若E''G'的一个规模为b的FAS, 则这四条边中, 至少有一条边e属于E'', 否则就会构成环(从构成四条边的顶点就可以发现这个事实). 而边e的两个顶点必然有一个属于{wi, wj}. 设C是一个空集, 如果wie的顶点, 则将vi加入C, 否则就将wj加入C. 这样处理完所有图G中的边后, 得到的C即是G的一个规模不超过b的顶点覆盖。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值