无向图短路径算法应用与BFS适用性分析.pdfVIP

  • 1
  • 0
  • 约1.09万字
  • 约 7页
  • 2025-10-22 发布于北京
  • 举报

无向图短路径算法应用与BFS适用性分析.pdf

COMP327(Fall2011)DataStructuresandAlgorithmsII

Quiz3.3:30-4:00pm,31stOctober2011

Name:StudentID:__________________Marks:/100

Question1ShortestPath[52marks]

Youaregivenanundirectedgraphasfollows.

(a)RunDijkstra’salgorithmtofindtheshortestpathfromvertex2toeveryvertex

ontheabovegraph.Writetherunningstepsinthefollowingtable.[42marks]

Solution:Foreachiteration:7marksforcorrectanswer.

IterationExtractUpdateMin-heapQ

vertexvertices

Initialization(2:0)(1:∞)(3:∞)(4:∞)(5:∞)(6:∞)

121,3,5(1:2)(5:4)(3:8)(4:∞)(6:∞)

213,4(5:4)(3:7)(4:7)(6:∞)

35∅(3:7)(4:7)(6:∞)

43(or4)∅(or6)(4:7)(6:∞)(or(3:7)(6:8))

54(or3)6(or∅)(6:8)

66∅∅

(b)Supposethatalledges

文档评论(0)

1亿VIP精品文档

相关文档