Dijkstra Algorithm post-Division blog

Source: Internet
Author: User

Topic Name: Dijkstra algorithm

Title: The relevant drawings are given in class, and the shortest path of the single source of the drawings vertex A is solved.
Figures:

The process of doing the problem

1. Learn about the Dijkstra algorithms, including definitions and how to use them.
Definition: The Dijkstra algorithm is a very representative algorithm. Dijkstra general expressions usually have two ways, a permanent and temporary marking, one is the way of open, close table, where permanent and temporary marking is used. Note that the algorithm requires no negative weight edges in the graph. The definition is as follows: the Dijkstra (Dijkstra) algorithm is a typical single-source shortest path algorithm for calculating the shortest path of a node to all other nodes. The main feature is to extend from the center of the starting point to the outer layer until it expands to the end point. Dijkstra algorithm is a very representative shortest path algorithm, in many professional courses as the basic content of the detailed introduction, such as data structure, graph theory, operations research and so on. Dijkstra general expressions usually have two ways, a permanent and temporary marking, one is the way of open, close table, where permanent and temporary marking is used. Note that the algorithm requires no negative weight edges in the graph.
2. How to use: The idea is to generate the shortest path algorithm according to the path length increment order, first define two groups:
(1) S: The set of vertices that have been found for the shortest path (initially containing only the source point V0)

(2) V-s=t: Vertex collection for which the shortest path has not been determined
In adding elements to ensure:
(1) The shortest path length from the source point V0 to the other vertices in S is less than the shortest path length from V0 to any vertex in t

(2) Each vertex corresponds to a distance value

S middle vertex: Shortest path length from V0 to this vertex

T-vertex: The shortest path length from V0 to this vertex that includes only the vertex in S as the middle vertex

According to: can prove V0 to the shortest path of vertex VK in T, or the weight of direct path from V0 to VK, or the sum of the path weights from V0 through the vertex of S to VK

(Proof of the absurdity of the law)
Finally, the concrete steps are:

    1. The distance value corresponding to the vertices in the remaining vertex},t in the initial seasonal s={v0},t={

If there is

If it does not exist

    1. Select a vertex w with a minimum distance value from T and not in S, join S

    2. Modify the distance values for vertices in the rest of T: If you add a W as an intermediate vertex and the distance value from V0 to VI is shortened, the distance value is modified

Repeat steps 2 and 3 above until all vertices are included in s, i.e. W=vi

Corresponding to this problem, you can draw a single source shortest path of vertex a according to the above steps:

Dijkstra Algorithm post-Division blog

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.