Dijkstra algorithm exercises in class

Source: Internet
Author: User

Dijkstra algorithm exercises in class

The Dijkstra algorithm solves the single source shortest path of the drawing vertex A, draws the solution process on the paper and uploads. (Note that you should have your own school number and name on the chart)

    • The teacher explains the process in the PPT in class such as:

    • Refer to Understanding Shortest path-Dijkstra (Dijkstra) algorithm, get the complete algorithm principle.
      • ① first, the introduction of an auxiliary vector D, each of its component d[i] means that the currently found Dijkstra algorithm runs the animation process Dijkstra algorithm runs the animation process from the starting point (that is, the source point) to the length of each other vertex. For example, d[3] = 2 means that the path from the starting point to the vertex 3 is a relative minimum length of 2. It is emphasized here that the value of D during the execution of the algorithm is constantly approaching the final result but not necessarily equal to the length in the process.

      • The initial state of the ②d is: if there is an arc from V to V[i] (that is, from V to V[i] there is a connecting edge), then D[i] is the weighted value on the arc (that is, the weight of the edge from V to v[i]; otherwise the d[i] is ∞. Obviously, a path of length d[j]= min{D |v[i]∈v} is the shortest path from V to Vertex V[j], which is (V,v[j]).

      • ③ so, which is the next shorter length? That is to find the vertex corresponding to the shortest path length from the source Point V to the next vertex, and this shortest path length is second only to the shortest path length from source point v to Vertex v[j]. Assuming that the end of the short path is v[k], it is conceivable that this path is either (V,v[k]), or (V,v[j],v[k]). Its length is either the weight on the arc from V to V[k], or the weight on the arc of D[j] plus from v[j] to v[k].

      • ④ generally, assuming that s is the set of vertices of the shortest path length from the source point V, it can be proved that the next shortest path (set its end point to X) is either an arc (v,x), or a path from the source point v that is only passing through the vertices in s and finally reaching the vertex. Therefore, the shortest path length of the next short length must be d[j]= min{d[i] |v[i]∈v-s}, where D is either the weight on the arc (V,v[i]) or the sum of the weights on the Di and arc (V[k], v[i]).

    • So look back on this topic, my initial answer is, wrong in ... The title is wrong, very silent.

    • So how do you change the process and the results by learning from the class?

Feelings:
    • The classroom attentively listens diligently to digest, after class again spends the kungfu to clarify. But the problem is still only one time is enough (cover face).

Dijkstra algorithm exercises in class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.