Single source Shortest path--dijkstra algorithm learning

Source: Internet
Author: User

Every time I think I understand dijkstra this algorithm, but not long and forget, this should be the 4th, 5 times to revisit this algorithm.

This is the Hu Peng of the "Geographic Information System", after reading the sudden realization of the mathematical formula to express the algorithm flow is so good understanding, perfect.

Excerpt from the following:

The shortest path in the network is a simple path, which is a path that does not intersect itself, and the shortest path search is based on: If there is a shortest path from S point to T Point, then the distance from any point on the path to S is the shortest.

Dijkstra algorithm Search steps:

1. Mark the starting point S, and make D (X) =∞,y=s for all vertices;

2. For all unmarked points, calculate the distance by the formula

D (x) =min{d (x), D (y,x) +d (y)}, where Y is the last point to make an identity.

Take the D (X) with the minimum value and mark the XWT to make the y=x.

If the minimum value of D (X) =∞, then s to all the non-identified points have no path, the algorithm terminates; otherwise, continue.

3. If y=t, the shortest path from S to T has been found, the algorithm terminates. Otherwise go to step 2.

Shortest path algorithm: Dijkstra algorithm and Floyd algorithm

Graph theory

Take a step: from the beginning startnode A to traverse an edge, select the shortest side link to Node B, the distance dabs.

Walk two steps: by B traverse the connected side, select the shortest one side, remember the temporary distance dtemp, at this time distance dab+dtemp;

And a take a step second short distance comparison, short distance as the distance to walk two steps.

Basically is "one step, one step, two steps back", to ensure that the effect, each step is the shortest path.

Reference: Design and implementation of the plug-in GIS application framework: Based on C # and AE 9.2

Single source Shortest path--dijkstra algorithm learning

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.