Time Complexity of Single-Source Shortest Path Algorithms
Published:
Graph data structures are widely used to represent different aspects of computer science (e.g., road networks). We can denote a graph as \(G = (V, E)\), where \(V\) represents the set of vertices (in the context of a road network, these represent intersections), and \(E\) represents the set of edges (representing road segments). We generally define \(n~(= |V|)\) as the number of vertices and \(m~(= |E|)\) as the number of edges to express the time and space complexity of graph algorithms. One such problem is single-source shortest path (SSSP), which is used to find the shortest path from a single node to all other nodes. For decades, Dijkstra’s algorithm has been the go-to method for solving this problem. The runtime of Dijkstra’s algorithm depends on the priority queue implementation and often has a complexity of \(O(m + n \log n)\). Read more
