`
leonzhx
  • 浏览: 796765 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
阅读更多

1.  Definitions:  

    --  Input : An edge-weighted digraph (edge capacity) , source vertex s, and target vertex t.

    --  st-cut : A partition of the vertices into two disjoint sets, with s in one set A and t in the other set B.

    --  capacity of the cut (A, B) : The sum of the capacities of the edges from A to B. 

    --  Minimum st-cut (mincut) problem: Find a cut of minimum capacity.



 

2.  Maxflow problem :

    --  Input: An edge-weighted (capacity) digraph , source vertex s, and target vertex t.

    --  An st-flow (flow) is an assignment of values to the edges such that:

        -  Capacity constraint: 0 ≤ edge's flow ≤ edge's capacity.

        -  Local equilibrium: inflow = outflow at every vertex (except s and t).

    --  The value of a flow is the inflow at t.( we assume no edge points to s or from t. )

    --  Maximum st-flow (maxflow) problem: Find a flow of maximum value.



 

3.  Remarkable fact: Mincut problem and Maxflow problem are dual!

 

4.  Ford-Fulkerson algorithm

    --  Initialization: Start with 0 flow.

    --  Find an augmenting path : undirected path from s to t such that:

        --  Can increase flow on forward edges (not full).

        --  Can decrease flow on backward edge (not empty).

    --  Increase flow along augmenting paths

    --  Termination: No augmenting path : All paths from s to t are blocked by either a

        --  Full forward edge.

        --  Empty backward edge.


 

 

5.  Relationship between flows and cuts:

    --  The net flow across a cut (A, B) is the sum of the flows on its edges from A to B minus the sum of the flows on its edges from from B to A.

    --  Flow-value lemma. Let f be any flow and let (A, B) be any cut. Then, the net flow across (A, B) equals the value of f.

        --  Pf. By induction on the size of B.

            -  Base case: B = { t }.

            -  Induction step: remains true by local equilibrium when moving any vertex from A to B.

    --  Weak duality: Let f be any flow and let (A, B) be any cut. Then, the value of the flow ≤ the capacity of the cut.

        --  Pf. Value of flow f = net flow across cut (A, B) ≤ capacity of cut (A, B).



 

6.  Maxflow-mincut theorem

    --  Augmenting path theorem: A flow f is a maxflow iff no augmenting paths.

    --  Maxflow-mincut theorem. Value of the maxflow = capacity of mincut.

    --  Pf. The following three conditions are equivalent for any flow f :

        i. There exists a cut whose capacity equals the value of the flow f.

        ii. f is a maxflow.

        iii. There is no augmenting path with respect to f.

        --  [ i ⇒ ii ]

            -  Suppose that (A, B) is a cut with capacity equal to the value of f.

            -  Then, the value of any flow f ' ≤ capacity of (A, B) = value of f.

            -  Thus, f is a maxflow.

        --  [ ii ⇒ iii ] We prove contrapositive: ~iii ⇒ ~ii.

            -  Suppose that there is an augmenting path with respect to f.

            -  Can improve flow f by sending flow along this path.

            -  Thus, f is not a maxflow.

        --  [ iii ⇒ i ]

            -  Suppose that there is no augmenting path with respect to f.

            -  Let (A, B) be a cut where A is the set of vertices connected to s by an undirected path with no full forward or empty backward edges.

            -  By definition, s is in A; since no augmenting path, t is in B.

            -  Capacity of cut = net flow across cut = value of flow f.

 

7.  Computing a mincut from a maxflow:

    --  By augmenting path theorem, no augmenting paths with respect to f.

    --  Compute A = set of vertices connected to s by an undirected path with no full forward or empty backward edges.



 

8.  Does FF always terminate?

    yes, provided edge capacities are integers (or augmenting paths are chosen carefully)

 

9.  Ford-Fulkerson algorithm with integer capacities :

    --  Important special case: Edge capacities are integers between 1 and U.

    --  Invariant: The flow is integer-valued throughout Ford-Fulkerson.

        -- Pf. [by induction]

            -  Bottleneck capacity is an integer.

            - Flow on an edge increases/decreases by bottleneck capacity.

    --  Proposition. Number of augmentations ≤ the value of the maxflow.

        --  Pf. Each augmentation increases the value by at least 1.

    --  Integrality theorem. There exists an integer-valued maxflow.

        --  Pf. Ford-Fulkerson terminates and maxflow that it finds is integer-valued.

    --  Bad news : Even when edge capacities are integers, number of augmenting paths could be equal to the value of the maxflow.

    --  Good news : This case is easily avoided. [use shortest/fattest path]



 

10.  FF performance depends on choice of augmenting paths :



 

11.  Implementation Considerations of FF:

    --  Flow edge data type: Associate flow fe and capacity ce with edge e = v→w.

    --  Flow network data type: Need to process edge e = v→w in either direction: Include e in both v and w's adjacency lists.

    --  Residual capacity:

        -  Forward edge: residual capacity = ce - fe.

        -  Backward edge: residual capacity = fe.

    --  Augment flow.

        -  Forward edge: add Δ.

        -  Backward edge: subtract Δ.

    --  Residual network : Augmenting path in original network is equivalent to directed path in residual network.



 

12.  Flow edge: Java implementation:

public class FlowEdge
{
    private final int v, w; // from v to w
    private final double capacity; // capacity
    private double flow; // flow

    public FlowEdge(int v, int w, double capacity)
    {
        this.v = v;
        this.w = w;
        this.capacity = capacity;
    }

    public int from() { return v; }
    public int to() { return w; }
    public double capacity() { return capacity; }
    public double flow() { return flow; }
    public int other(int vertex)
    {
        if (vertex == v) return w;
        else if (vertex == w) return v;
        else throw new RuntimeException("Illegal endpoint");
    }

    public double residualCapacityTo(int vertex)
    {
        if (vertex == v) return flow; // from w to v , backward edge
        else if (vertex == w) return capacity - flow; // from v to w, forward edge
        else throw new IllegalArgumentException();
    }

    public void addResidualFlowTo(int vertex, double delta)
    {
        if (vertex == v) flow -= delta; //backward edge
        else if (vertex == w) flow += delta; //forward edge
        else throw new IllegalArgumentException();
    }
}

 

13.  Flow network: Java implementation :

public class FlowNetwork
{
    private final int V;
    private Bag<FlowEdge>[] adj;
    public FlowNetwork(int V)
    {
        this.V = V;
        adj = (Bag<FlowEdge>[]) new Bag[V];
        for (int v = 0; v < V; v++)
            adj[v] = new Bag<FlowEdge>();
    }

    public void addEdge(FlowEdge e)
    {
        int v = e.from();
        int w = e.to();
        adj[v].add(e);
        adj[w].add(e);
    }

    public Iterable<FlowEdge> adj(int v)
    { return adj[v]; }
}

 

14.  Ford-Fulkerson: Java implementation :

public class FordFulkerson
{
    private boolean[] marked; // true if s->v path in residual network
    private FlowEdge[] edgeTo; // last edge on s->v path
    private double value; // value of flow
    
    public FordFulkerson(FlowNetwork G, int s, int t)
    {
        value = 0.0;
        while (hasAugmentingPath(G, s, t))
        {
            double bottle = Double.POSITIVE_INFINITY;
            for (int v = t; v != s; v = edgeTo[v].other(v))
                bottle = Math.min(bottle, edgeTo[v].residualCapacityTo(v));
            for (int v = t; v != s; v = edgeTo[v].other(v))
                edgeTo[v].addResidualFlowTo(v, bottle);
            value += bottle;
        }
    }

    public double value()
    { return value; }

    public boolean inCut(int v)
    { return marked[v]; }

    private boolean hasAugmentingPath(FlowNetwork G, int s, int t)
    {
        edgeTo = new FlowEdge[G.V()];
        marked = new boolean[G.V()];
        Queue<Integer> queue = new Queue<Integer>();
        queue.enqueue(s);
        marked[s] = true;
        while (!queue.isEmpty())
        {
            int v = queue.dequeue();
            for (FlowEdge e : G.adj(v))
            {
                int w = e.other(v);
                if (e.residualCapacityTo(w) > 0 && !marked[w])
                {
                    edgeTo[w] = e;
                    marked[w] = true;
                    queue.enqueue(w);
                }
            }
        }
        return marked[t];
    }
}

 

15.  Maxflow application on bipartite matching :

    --  Problem definition: (Given a bipartite graph, find a perfect matching.)

        -  N students apply for N jobs.

        -  Is there a way to match all students to jobs?

    --  Network flow formulation of bipartite matching :

        -  Create s, t, one vertex for each student, and one vertex for each job.

        -  Add edge from s to each student (capacity 1).

        -  Add edge from each job to t (capacity 1).

        -  Add edge from student to each job offered (infinite capacity).



 

    --  When no perfect matching, mincut explains why :

        Consider mincut (A, B).

        -  Let S = students on s side of cut.

        -  Let T = companies on s side of cut.

        -  Fact: | S | > | T |; students in S can be matched only to companies in T.



 

16.  Maxflow application on Baseball elimination problem :

    --  Problem definition: Which teams have a chance of finishing the season with the most wins?



 

    --  Observation. Answer depends not only on how many games already won and left to play, but on whom they're against.

    --  maxflow formulation : Remaining games flow from s to t.



 

    --   Team 4 not eliminated iff all edges pointing from s are full in maxflow.

 

  • 大小: 18 KB
  • 大小: 18.8 KB
  • 大小: 28 KB
  • 大小: 24.4 KB
  • 大小: 28 KB
  • 大小: 11.6 KB
  • 大小: 35.1 KB
  • 大小: 50.2 KB
  • 大小: 29.2 KB
  • 大小: 43.5 KB
  • 大小: 25.9 KB
  • 大小: 37.1 KB
  • 大小: 36.1 KB
分享到:
评论

相关推荐

    Network Algorithms Maximum Flow:网络最大流算法.ppt

    Network Algorithms Maximum Flow:网络最大流算法.ppt

    the-maximum-flow-problem-.zip_maximum flow_maximum flow problem_

    用增广路法计算最大流问题,给出了C++代码

    A maximum flow algorithm for buffer-limited delay tolerant networks

    As a fundamental problem, the maximum flow problem is of vital importance for routing and service scheduling in networks. However, there exists no permanent end-to-end path since the topology and the...

    Minimum-cost-maximum-flow-.zip_最大网络流

    在给定的“Minimum-cost-maximum-flow-.zip”压缩包文件中,我们关注的核心是“最小费用最大流”问题,这是一个在保证流量最大化的同时,力求使总费用最小化的经典算法。 在图论中,一个网络通常由节点(或顶点)...

    maxflow算法matlab/c++混编

    "maxflow算法matlab/c++混编"的主题涉及如何使用这两种编程语言来实现最大流算法。在这个场景中,我们主要探讨两个核心概念:最大流算法和混合编程。 首先,最大流算法是解决网络流问题的一种方法,目标是在给定的...

    An Experimental Comparison of Min-Cut/Max-Flow Algorithms

    minimum cut/maximum flow algorithms on graphs emerged as an increasingly useful tool for exact or approximate energy minimization in low-level vision. The combinatorial optimization literature ...

    maximum_flow.rar_maximum_flow

    最大流问题是一个经典的图论问题,它在网络流理论中占据着核心地位。该问题旨在确定在一个有向图中,从源点到汇点的最大可能流量。在这个问题中,每条边都有一个容量限制,流量不能超过这个限制,同时满足流量守恒...

    Max Flow, Min Cut_有关图像切割

    #### 最大流(Maximum Flow) 最大流问题是指在一个有向图中寻找一种流量分配方案,使得从源节点\( s \)到汇节点\( t \)的最大流量值达到最大。每条边有一个容量限制,表示该边能够通过的最大流量值。最大流问题的目标...

    mincostmaxflow.zip_62PQ_have51l_network flow_最小费用最大流_网络流

    最小费用最大流(Minimum Cost Maximum Flow, MCMF)是网络流问题的一个特例,它不仅要求达到最大的流,还要使这个过程中的总费用最小。在本案例中,提供的压缩包文件"mincostmaxflow.zip"包含了处理这种问题的...

    lingo最小费用最大流

    在IT领域,网络流问题是一种经典的优化问题,用于解决如何在网络中从源点到汇点有效地分配资源。在这个特定的问题中,"lingo最小费用最大流"是指利用LINGO软件来解决一个网络中的最小费用最大流问题。...

    matlab图论程序算法大全_matlab图论_matlab_最小生成数_源码

    1. **最小费用最大电流(Minimum Cost Maximum Flow)**: 这个问题在网络流理论中非常重要,目的是找到网络中从源节点到汇点的最大流量,同时使总成本(或代价)最小。MATLAB提供了`maxflow`函数,可以求解这类...

    网络流最大流算法.ppt

    Maximum Flow-Minimum Cut Theorem是网络流最大流算法的一个重要定理,该定理表明,最大流的流量等于最小割的容量。该定理的证明可以分为三步: 1. 任意一个流小于等于任意一个割的容量 2. 存在一个割,使得该割的...

    Edmonds_Karp算法模版

    cout &lt;&lt; "Maximum Flow: " &lt;&lt; maxFlow(0, n - 1) ; return 0; } ``` 这段代码实现了Edmonds-Karp算法的核心部分,包括寻找最短增广路径以及更新流的过程。 ### 总结 Edmonds-Karp算法是解决最大流问题的一种...

    上海交大ACM模板 (文件有问题 请注意下载 似乎foxit reader1.3可以打开,版本高的阅读器反而打不开)

    - **2.8 Maximum Flow—Ford Fulkson in Matrix** (最大流—矩阵形式的Ford-Fulkson算法): 解决最大流问题的一种经典方法。 - **2.9 Maximum Flow—Ford Fulkson in Link** (最大流—链式形式的Ford-Fulkson算法): ...

    MCMF.zip_MCMF_MCMF C++_最小费用流

    最小费用最大流(Minimum Cost Maximum Flow,简称MCMF)是运筹学和图论中的一个重要概念,用于解决网络流问题。在这个问题中,我们有一个带权重的有向图,每条边代表一种容量限制,并且有与之相关的费用。我们的...

    5G网络优化QoS管理机制.pptx

    此外,MBR(Maximum Bit Rate)和GBR(Guaranteed Bit Rate)定义了最大和保证的带宽,而GFBR(Guaranteed Flow Bit Rate)和MFBR(Maximum Flow Bit Rate)则是5G中与QoS流相关的速率保障参数。 在5G网络中,QoS ...

    5G NR QOS概述.pdf

    QoS配置包含一系列参数,如5QI(5G QoS Identifier)、ARP(Access Priority Rank Indicator),以及GBR流的GFBR(Guaranteed Flow Bit Rate)和MFBR(Maximum Flow Bit Rate)。此外,GBR流可能还包括指示控制和...

    内含pygraph.classes.digraph包

    标题提到的 "内含pygraph.classes.digraph包" 指的是该压缩包包含了 PyGraph 库中的有向图类,这对于理解和实现最小割(Minimum Cut)和最大流(Maximum Flow)问题是非常有用的。 最小割和最大流是图论中的经典...

Global site tag (gtag.js) - Google Analytics