开发三道工序课件.ppt

上传人(卖家):晟晟文业 文档编号:4599299 上传时间:2022-12-23 格式:PPT 页数:144 大小:1.42MB
下载 相关 举报
开发三道工序课件.ppt_第1页
第1页 / 共144页
开发三道工序课件.ppt_第2页
第2页 / 共144页
开发三道工序课件.ppt_第3页
第3页 / 共144页
开发三道工序课件.ppt_第4页
第4页 / 共144页
开发三道工序课件.ppt_第5页
第5页 / 共144页
点击查看更多>>
资源描述

1、1Chapter 15Graphs,Trees,and Networks2Chap.15 15.1 Undirected Graphs15.2 Directed Graphs15.3 Trees15.4 Networks15.5 Graph Algorithms Minimum Spanning Tree Shortest Path3 Chap.15 (Cont.)15.6 Network Class 開發三道工序開發三道工序:4Graph theory 圖論圖論From Wikipedia,the free encyclopedia In mathematics and computer s

2、cience,graph theory is the study of graphs,mathematical structures used to model pair-wise relations between objects from a certain collection.某 collection 的 objects 的兩兩關係5Applications of Graphs 許多實際問題可用graph來表示。例如連接結構的一個網站,可以用有向圖(directed graph):頂點(vertex)是網頁網址,如果有一個網頁B連結到網頁A,便有個連結(edge)在兩者A,B之間。類似

3、的,在travel問題,生物學,computer chip的設計,以及其他許多領域。開發algorithm來處理graph,因此主要應用是在computer science。graph 可延伸為weighted graph(加權圖)。例如,weight能夠代表連結(edge)的長度。615.1 Undirected Graphs7Example:X Y Z T Ans:5 Vertices 6 Edges S8 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet91011S6 Network Class 開發三道

4、工序:A linked list!X某 collection 的 objects 的兩兩關係Perform a depth-first iteration from S.StackVertex returned by next()Z,T SHashSet TreeSetList Setx v5 Graph Algorithms6 A Network Class6 A Network ClassSqueueVertex returned by next()Z,T SV,TYY Z開發algorithm來處理graph,因此主要應用是在computer science。12 X Y Z TX,Y,

5、T,Z,S has length 4.Shortest path from X to S=?Ans:2 SIn general,how can the smallest path between 2 vertices be determined?We will cover that.1314 X Y Z TX,Y,T,Z,X is a cycle.Y,T,S,Z,T,Y is not a cycle.(repeated edges:YT and TY)SIs Y,Z,T,S,Z,X,Y a cycle?Yes!15 Collection List Set ArrayList LinkedLis

6、t SortedSet HashSet TreeSetThis undirected graph is acyclic.16171815.2 Directed Graphs19 Main StreetState Avenue Park PlaceWest Street East Street South Kihei Road202122X,Zthe direction of the arrow.Graph theory 圖論From Wikipedia,the free encyclopediaV,Zorder is unimportant:HashSet TreeSet6 Network C

7、lass 開發三道工序:5 Graph AlgorithmsAssume the edges are inserted into the graph as follows:TNetwork ClassS,T /Same as T,SCollectionPerform a depth-first iteration from S.Y ZStackVertex returned by next()Y Z232415.3 Trees25 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet2615.4 Networks2

8、7282930313215.5 Graph Algorithms333435 x v Y Z T SAssume the vertices are entered in alphabetical order.Perform a breadth-first iteration from S.Ans:S,T,Z,Y,V,X 36Y ZS,ZA collection in whichFor a breadth-first iteration of a directed graph,order is unimportant:Z,T SHashSet TreeSetY ZList Set6 Networ

9、k Class 開發三道工序:SAssume the edges are inserted into the graph as follows:Assume the edges are inserted into the graph as follows:order is unimportant:ArrayList LinkedList SortedSetpriority queue(pq):;remove S,T (Same as T,S)Athe algorithm is the same,but“neighbor”takes into accountS37383940 X V Y Z T

10、 S41Assume the edges are inserted into the graph as follows:S,T (Same as T,S)S,Z T,Y T,Z V,X V,Z X,Y X,ZPerform a breadth-first iteration from S.42 queueVertex returned by next()S T,ZS Z,YT Y,V,XZ V,XY XV X enqueuedequeue43444546For a breadth-first iteration of a directed graph,the algorithm is the

11、same,but“neighbor”takes into account the direction of the arrow.A B C DStarting at A,the neighbors of A are B and C,but not D.D NEVER gets enqueued,and never gets returned by next().Y,V,TXXV,XV,XYT,YHashSet TreeSetCV,ZTHashSet TreeSetZ,YTcheck Cs neighbors,find;and add it to pq;5 VerticesT,YCollecti

12、on6 A Network ClassZ,T SA collection in which6 Network Class 開發三道工序:Perform a depth-first iteration from S.HashSet TreeSet4748 Collection List Set ArrayList LinkedList SortedSet HashSet TreeSet4950A Stack!51 X V Y Z T S52Assume the edges are inserted into the graph as follows:S,T /Same as T,S S,Z T,

13、Y T,Z V,X V,Z X,Y X,ZPerform a depth-first iteration from S.53 StackVertex returned by next()S Z,T S X,V,TZ Y,V,TX V,TY T VTTop Bottom545556order is unimportant:T某 collection 的 objects 的兩兩關係X6 Network Class 開發三道工序:Starting at A,the neighbors of A are B and C,but not D.ArrayList LinkedList SortedSetX

14、Graph theory 圖論From Wikipedia,the free encyclopedia2 Directed Graphs5 Graph AlgorithmsT,ZSY ZS,ZPerform a depth-first iteration from S.CollectionX,Y,T,Z,X is a cycle.Trees,andB C DAssume the edges are inserted into the graph as follows:Y Z575859606162636465666768692 Directed GraphsV,TYV,XStackVertex

15、 returned by next()7 2In mathematics and computer science,graph theory is the study of graphs,mathematical structures used to model pair-wise relations between objects from a certain collection.TArrayList LinkedList SortedSetArrayList LinkedList SortedSet某 collection 的 objects 的兩兩關係5 Graph Algorithm

16、s5 Graph Algorithmsthe direction of the arrow.Assume the edges are inserted into the graph as follows:6 A Network ClassAssume the edges are inserted into the graph as follows:x vV,ZX VT7071727374757677Key Idea C 7 2 A 10 B priority queue(pq):;remove check Cs neighbors,find;and add it to pq;mark C th

17、e predecessor of B Now,pq:787980818283848586878889For a breadth-first iteration of a directed graph,Perform a depth-first iteration from S.Graph theory 圖論From Wikipedia,the free encyclopediapriority queue(pq):;remove Y ZT,Z5 Graph AlgorithmsThis undirected graph is acyclic.6 Network Class 開發三道工序:Arr

18、ayList LinkedList SortedSetNetwork Class許多實際問題可用graph來表示。Y ZCollectionY ZY ZIs Y,Z,T,S,Z,X,Y a cycle?Yes!Perform a breadth-first iteration from S.ArrayList LinkedList SortedSet909115.6 A Network Class929394Network Class9596979899100101102103104105106Network Class107108109110A collection in which order is unimportant:A linked list!111112113114115116117118119Network Class120121122123124125126127128129130131132133134135136137138139140141142143144

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 办公、行业 > 各类PPT课件(模板)
版权提示 | 免责声明

1,本文(开发三道工序课件.ppt)为本站会员(晟晟文业)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|