cs3460_ch9_network_flow 美国高校《数据结构》(Data Structure)ppt课件,共9章,英文版
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
The Network Flow Problem
• Each graph has a source (s below) and a sink (t below); edges have capacity values
• The goal is to find a combination of flows that allow a maximal flow from source to sink
• The flow graph is in the center and it is the maximal flow, but this cannot be guaranteed since alternative selections may be suboptimal
Why the Simple Algorithm Fails
Group Work
• Find the maximum flow in the following network using residual graphs with augmenting
ห้องสมุดไป่ตู้
• Now there is a flow of 2 from s to b,d,a,c and t
Modifying the Algorithm - 2
• Adding that flow results in the middle graph • The residual graph now has no flow from s to t,
so the resultant flow is maximal
Worst Case for Augmenting
• For some graphs, augmenting may not be efficient, such as the graph below
• It would take 2,000,000 selections of the edge from a to b with augmenting, while the outer edges would be more efficient
• We modify the algorithm to add backflow edges to allow undoing of poor choices
Modifying the Algorithm - 1
• If the flow with 3’s is selected, backwards arrows are added to the residual graph to allow the choice to be undone; this is called augmenting
• Suppose initially the flow of 3 units shown in the middle below was selected
• The residual graph on the right has no more possible flow paths, so this solution is suboptimal
• The initial graph is shown at the right
• The maximal flow through the network is shown at the left
A Simple Algorithm - 2
A Simple Algorithm – 3
• When the residual graph has on flow left from source to sink, the algorithm terminates
• Each graph has a source (s below) and a sink (t below); edges have capacity values
• The goal is to find a combination of flows that allow a maximal flow from source to sink
• The flow graph is in the center and it is the maximal flow, but this cannot be guaranteed since alternative selections may be suboptimal
Why the Simple Algorithm Fails
Group Work
• Find the maximum flow in the following network using residual graphs with augmenting
ห้องสมุดไป่ตู้
• Now there is a flow of 2 from s to b,d,a,c and t
Modifying the Algorithm - 2
• Adding that flow results in the middle graph • The residual graph now has no flow from s to t,
so the resultant flow is maximal
Worst Case for Augmenting
• For some graphs, augmenting may not be efficient, such as the graph below
• It would take 2,000,000 selections of the edge from a to b with augmenting, while the outer edges would be more efficient
• We modify the algorithm to add backflow edges to allow undoing of poor choices
Modifying the Algorithm - 1
• If the flow with 3’s is selected, backwards arrows are added to the residual graph to allow the choice to be undone; this is called augmenting
• Suppose initially the flow of 3 units shown in the middle below was selected
• The residual graph on the right has no more possible flow paths, so this solution is suboptimal
• The initial graph is shown at the right
• The maximal flow through the network is shown at the left
A Simple Algorithm - 2
A Simple Algorithm – 3
• When the residual graph has on flow left from source to sink, the algorithm terminates