离散数学课件6-6 shortest-Path Problems 33.pptx

  1. 1、本文档共31页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Discrete Mathematics South China University of TechnologyChapter 8. GraphsShortest-Path ProblemsSection 8.6Contents1Shortest Path Problems2Dijkstra’s Algorithm3The traveling salesman problemShortest Path ProblemsIntroductionMany problems can be modeled using graphs with weights assigned to their edges.Problems involving distances can be modeled by assigning distances between cities to the edges.Problems involving flight time can be modeled by assigning flight time to the edges.Problems involving fares can be modeled by assigning fares to the edges.Dijkstra’s AlgorithmA Shortest-Path AlgorithmThere are several different algorithms that find a shortest path between two vertices in a weighted graph.This section will present the classical algorithm: Dijkstra’s Algorithm proposed by Dutch mathematician Edsger Dijkstra.324bc3az213deThe only paths starting at a that contain no vertex other than a (until the terminal vertex is reached) are (a, b) and (a, d).Since the lengths of (a, b) and (a, d) are 4 and 2, d is the closest vertex to a.324bc3az213deWe can find the next closest vertex by looking at all paths that go through only a and d.The shortest such path to b is still a, b, with length 4, and the shortest such path to e is a, d, e, with length 5. So the next closest vertex to a is b.324bc3az213deFor the next closest vertex to a, we need to examine only paths that go through only a, d, and b (until the terminal vertex is reached).There is a path of length 7 to c, namely a, b, c and a path of length 6 to z, namely, a, d, e, z. So z is the next closest vertex to a, and its length is 6.Dijkstra’s idea?Given start vertex s, find the shortest path from s to all other vertices ?the length of edge Lthe length between vertex and .: the vertexes set of shortest path.Dijkstra’s idea?initialization: L2. search 3. 4. for each vertex if L+ then LL+Repeat 2,3,4 until P=V.Algorithm 1: Dijkstra’s AlgorithmProcedure Dijkstra (G: weighted connected simple graph, with all weights

文档评论(0)

qingfengxulai + 关注
实名认证
内容提供者

文档来源于网络

1亿VIP精品文档

相关文档