In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Dijkstra algorithm example Analysis", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Dijkstra algorithm example analysis" it!
Dijkstra (Dijstra) algorithm is a typical single-source shortest path algorithm, which is used to calculate the shortest path from one node to all other nodes. The main feature is that it expands layer by layer with the starting point as the center until it reaches the end point.
The shortest path? Literally, the shortest path from one vertex to another in a graph with boundary values.
Official definition: for an intranet graph, the shortest path refers to the path that minimizes the sum of edge weights between two vertices.
And we call the first vertex on the path the source point and the last vertex the end point.
Because the non-intranet graph has no weight on the edge, the so-called shortest path actually refers to the path with the least number of edges between the two vertices.
Its main feature is to expand outward layer by layer with the starting point as the center (breadth-first search idea) until it reaches the end point.
The time complexity of Dijstra algorithm is 0 (n ^ 2).
In the implementation steps, the algorithm is similar to the Prim algorithm in finding the minimum distance from the most original vertices to all vertices step by step.
But if we want to find the minimum distance from another point to all points, we have to run the algorithm again.
# define maxV 9 / / maximum number of vertices # define min 65535; void DJSTL (MGraph G, int pos) / / pos the minimum distance from this point to the rest of the points {bool final [maxV]; / / determine whether it has been saved in the S set int ShortPath [maxV]; / / the distance from one point to the rest of the points stores the length int PathArc [maxV]; / / stores the shortest path subscript for (int I = 0) IV4- > V3-> V6-> V7-> V8
At this point, I believe that everyone on the "Dijkstra algorithm example analysis" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.