Since the asymptotic behavior of the naive implementation of Dijkstra's algorithm is:
\(O(n^2 + m)\), then as the number of vertices increases, the speed of work becomes unsatisfactory.
Various data structures can be used for improvement: Fibonacci heaps,
set sets, or a priority queue
priority_queue.
Consider an example with
set, as a result, the final asymptotics is:
\(O(n log (m))\),
details.