湘潭大学数据结构课件pptCh09Graph.pptVIP

  • 0
  • 0
  • 约1.53万字
  • 约 50页
  • 2019-09-14 发布于湖北
  • 举报
§3 最短路径算法 ? 无权最短路径 v1 v2 v6 v7 v3 v4 v5 0 0: ? v3 1: ? v1 and v6 1 1 2: ? v2 and v4 2 2 3: ? v5 and v7 3 3 ? 算法梗概 广度优先搜索 ? 实现 Table[ i ].Dist ::= distance from s to vi /* initialized to be ? except for s */ Table[ i ].Known ::= 1 if vi is checked; or 0 if not Table[ i ].Path ::= for tracking the path /* initialized to be 0 */ §3 最短路径算法 void Unweighted( Table T ) { int CurrDist; Vertex V, W; for ( CurrDist = 0; CurrDist NumVertex; CurrDist ++ ) { for ( each vertex V ) if ( !T[ V ].Known T[ V ].Dist == CurrDist ) { T[ V ].Known = true; for ( each W adj

文档评论(0)

1亿VIP精品文档

相关文档