Breadth-First Search of Graphs.ppt
《Breadth-First Search of Graphs.ppt》由会员分享,可在线阅读,更多相关《Breadth-First Search of Graphs.ppt(47页珍藏版)》请在麦多课文档分享上搜索。
1、Breadth-First Search of Graphs,Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University,Analysis of Algorithms,Applications of Breadth-First Search of Graphs,Single Source Shortest PathGraph Matching,Reading on Breadth-First Search of Graphs,Reading Selection: CLR, Ch
2、apter 24,Breadth-First Search Algorithm Input,Breadth-First Search Algorithm,Breadth-First Search Algorithm Output,Edges in Breadth-First Search,All edges u,v E have level distance 1,Breadth-First Search Tree,Breadth First Search Tree T,3,2,4,1,6,8,7,LEVEL(0) =1,LEVEL(1)=2,3,4,5,LEVEL(2)=6,7,8,5,roo
3、t r,Single Source Shortest Paths Problem,problem: For each vertex v, determine D(v) = min length path from root r to v,Dijkstras Algorithm for Single Source Shortest Paths,Example Single Source Shortest Paths Problem,example,Example Execution of Dijkstras Algorithm,Proof of Dijkstras Algorithm,Use i
4、nduction hypothesis:,Proof of Dijkstras Algorithm (contd),Time Cost of Dijkstras Algorithm on a RAM Model,Time cost: per iterationSince there are |V| iterations,Total Time O( |V| (log |V| ) + |E|),Graph Matching,Graph G = (V,E) Graph Matching M is a subset of E if e1, e2 distinct edges in M Then the
5、y have no vertex in commonVertex v is matched if v is in an edge of M,example,Graph Matching Problem,Graph Matching Problem:Find a maximum size matchingSuppose:G = (V,E) has matching MGoal: find a larger matching,Augmenting Path in G given Graph Matching M,An augmenting path p = (e1, e2, , ek),Graph
6、 Matching (contd),Initial matching M in GAugmenting pathp = (5,2), (2,6), (6,4), (4,7), (7,3),Graph Matching (contd),New matching M = P M = (P M) (P M),Characterization of a Maximum Graph Matching via Lack of Augmented Path,TheoremM is maximum matching iff there is no augmenting pathrelative to M,Pr
7、oof of Characterization of Maximum Graph Matching (contd),Proof (1) If M is smaller matching and p is an augmenting path for M,then M P is a matching size |M|(2) If M, M are matchings with |M| |M|,Claim: M M contains an augmenting path for M.,Proof The graph G = (V, M M )has only paths with edges al
8、ternating between M and M.Repeatedly delete a cycle in G (with equal number of edges in M, M )Since |M| |M| must eventually getaugmenting path remaining for M.,Maximum Matching Algorithm,Algorithm,Maximum Matching (contd),Remaining problem:Find augmenting pathAssume weighting d: E R+ = pos. reals,Ma
9、ximum Weighted Matching Algorithm,Assume weighting d: E R+ = positive reals Theorem Let M be maximum weight among matchings of size |M|. Let P be an augmenting path for M of maximum weight. Then matching M P is of maximum weight among matchings of size |M|+1.,Proof of Maximum Weighted Matching Algor
10、ithm,Proof Let M be any maximum weight matching of size |M|+ 1. Consider the graph G = (V, M M ). Then the maximum weight augmenting path p in G gives a matching M P of the same weight as M.,Bipartite Graph,Bipartite Graph G = (V,E),Breadth-First Search Algorithm for Augmented Path,Assume G is bipar
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- BREADTHFIRSTSEARCHOFGRAPHSPPT
