Solution - TAMU Computer Science Faculty Pages
Transcription
Solution - TAMU Computer Science Faculty Pages
26.2-11 Define a flow network πΊπ ,π‘ for any two vertices π and π‘ in πΊ by switching to the direct version of graph πΊ with π as source and π‘ as sink, and all edgesβ capacities are set to 1 to have the number of edges crossing a cut in πΊ equals to the capacity of cut in πΊπ ,π‘ . For each edge (π’, π£) β πΈ, the directed edge from π’ to π£ also need a directed edge from π£ to π’ when transform an edge from an undirected graph. Suppose ππ ,π‘ is a maximum flow in ππ ,π‘ . For any π β π, the edge connectivity π = min {ππ ,π‘ }. π‘βπβ{π } 26.3-3 By definition, an augmenting path is a simple path π β π‘ in the residual graph πΊβ²π . Since πΊ has no edges between vertices in πΏ and no edges between vertices in π , neither does the flow network πΊβ² and hence neither does πΊβ²π . Also, the only edges involving π or π‘ connect π to πΏ and π to π‘. Note that although edges in πΊβ² can go only from πΏ to π , edges in πΊβ²π can also go from π to πΏ. Thus any augmenting path must go π β πΏ β π β β― β πΏ β π β π‘, crossing back and forth between πΏ and π at most as many times as it can do so without using a vertex twice. It contains π , π‘, and equal numbers of distinct vertices from πΏ and π : at most 2 + 2 × πππ(|πΏ|, |π |) vertices in all. The length of an augmenting path (i.e., its number of edges) is thus bounded above by 2 β πππ(|πΏ|, |π |) + 1. 26.1 1. If each vertex has their own capacity, we can split each vertex π£π,π into two end points: one is the source point (π π,π ) and the other is the terminal point (π‘π,π ). An edge with the same capacity as the vertex is added between these two corresponding end points (pointing from source to terminal). All incoming edges of any vertex π£π,π are connected to its source point, and all outgoing edges of the vertex are connected to its terminal point. Obviously, the valid flow in the original network is still feasible in the new network. The transformation can be visualized as follows: For time complexity, the newly created graph has 2π vertices and (|πΈ| + |π|) edges. The total time complexity is π(ππΈ 2 ). 2. Starting from transforming the undirected graph into a flow network. This can be done by the following two steps: First, replace each undirected edge (π’, π£) β πΈ with bidirectional edges. The capacity of each directed edge is assigned weight 1 as shown in the figures below. Since the given graph is a π × π grid, the time complexity for this stage is (π2 ) . Second, add a source vertex π and an edge of weight 1 from π to each starting point. Also, add a sink vertex π‘ and an edge of weight 1 from each boundary vertex to π‘. Since there are π starting points and at most 4π boundary vertices, the time complexity is estimated as π(π). Finally, we can run Edmond-Karp algorithm to solve the escape problem. The total time complexity will be π(ππΈ 2 ) = π(π2 × π4 ) = π(π6 ).