You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Dijkstra Algorithm/README.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,8 @@ The best example is road network. If you wnat to find the shortest path from you
9
9
I have a gif example, which will show you how algorithm works. If this is not enough, then you can play with my **VisualizedDijkstra.playground**.
10
10
So let's image, that your house is "A" vertex and your job is "B" vertex. And you are lucky, you have graph with all possible routes.
11
11
When the algorithm starts to work initial graph looks like this:
12
-
[Images/image1.png]
12
+
13
+
<imgsrc="Images/image1.png"height="250" />
13
14
14
15
The table below will represent graph state
15
16
@@ -50,42 +51,45 @@ Then we set this vertex as visited
50
51
| Path Vertices From Start |[A]|[]|[]|[]|[]|
51
52
52
53
checkingVertex.visited = true
53
-
[Images/image2.jpg]
54
+
55
+
<imgsrc="Images/image2.png"height="250" />
56
+
54
57
Then we check all of its neighbors.
55
58
If neighbor's path length from start is bigger than checking vertex path length from start + edge weigth, then we set neighbor's path length from start new value and append to its pathVerticesFromStart array new vertex: checkingVertex. Repeat this action for every vertex.
0 commit comments