Implementation of Djikstra's Algorithm in python Djikstra's algo is used to find the shortest path from a source vertex to a destination vertex. Time complexity - O(m * n) Here, m is the number of the edges in the graph and n is the number of vertices in the graph. Worst time complexity - O(n^2) This is because the maximun number of edges a single vertex can have is n-1.