Download presentation
Presentation is loading. Please wait.
Published byErin Diane Townsend Modified over 9 years ago
1
1 CPSC 320: Intermediate Algorithm Design and Analysis July 14, 2014
2
2 Course Outline Introduction and basic concepts Asymptotic notation Greedy algorithms Graph theory Amortized analysis Recursion Divide-and-conquer algorithms Randomized algorithms Dynamic programming algorithms NP-completeness
3
3 Maximum Flow Problem
4
4 Maximum Flow Assume a directed graph where each edge has a capacity Assume two nodes (source and sink) Problem: find a flow from source to sink that uses maximum possible value In any node (except source and sink) incoming flow equals outgoing flow Application: Flow of materials from a system to a client (e.g., water pipes) Flow of electrical current through a network Transportation of goods
5
5 Maximum Flow – Formal Definitions
6
6 Ford-Fulkerson Method
7
7 Residual Network
8
8 Flow augmentation
9
9 Augmenting path
10
10 Ford-Fulkerson Algorithm
11
11 Minimum Cut Cut: partition of the nodes of a graph such that two nodes are in different subsets Capacity of the cut: sum of the capacities of all cut edges in one direction Minimum cut: cut with minimum capacity Applications: Network reliability evaluation
12
12 Minimum Cut – Formal Definitions
13
13 Relationship between flow and cut
14
14 Minimum Spanning Tree
15
15 Spanning Tree
16
16 Example
17
17 Strategies Prim’s method: Start with a randomly selected node Pick smallest cost edge connecting visited node to a new node Add it to the tree Repeat until tree is complete Kruskal’s method: Start with all nodes isolated and no edges Pick smallest cost edge left that doesn’t create a cycle Add it to the tree Repeat until tree is complete
18
18 Kruskal’s Algorithm
19
19 Time Complexity
20
20 Union-Find Data Structure
21
21 Union-Find Data Structure
22
22 Array implementation
23
23 Tree implementation
24
24 Tree implementation (cont.) Path compression: When find is performed, every node in the path is updated to point to root What is the bound for find now?
25
25 Cost claims
26
26 Amortized Analysis
27
27 Amortized cost
28
28 Array Implementation of Union-Find
29
29 Push/Multipop Stack
30
30 Push/Multipop Stack
31
31 Potential Method (aka Accounting Method)
32
32 Example
33
33 Binary Counter
34
34 Union-Find with Path Compression
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.