Fast algorithms for shortest paths

Fast Shortest Path Algorithms

Document information

Author

Qa ~[g.3 .Mb05

School

University Of Canterbury

Major Computer Science
Document type Thesis
Language English
Format | PDF
Size 4.59 MB

Summary

I.New Algorithms for the All Pairs Shortest Path APSP Problem

This research presents novel algorithms for solving the All Pairs Shortest Path (APSP) problem in non-negatively weighted directed graphs. It improves upon existing bounds, addressing a major open problem concerning the complexity of the APSP problem. The algorithms' performance is analyzed in terms of both worst-case and average-case running time, comparing them to classical algorithms like Dijkstra's algorithm and the Floyd-Warshall algorithm. Key performance metrics include the number of additions and binary comparisons of path and edge costs. The research explores the computational complexity of these algorithms, particularly within the random access machine model. A significant contribution is the development of an algorithm with a worst-case running time of O(n³), making it competitive with established O(n³) methods. The analysis considers the impact of various heuristics on algorithm efficiency.

1. Introduction and Problem Definition

The core problem addressed is finding all shortest paths within a non-negatively weighted directed graph. The research introduces several new algorithms designed to solve this problem efficiently on graphs with 'n' vertices and 'm' edges. A key focus is on improving the computational complexity compared to existing methods. The initial algorithm presented boasts a worst-case runtime of min{2mn, n³} + O(n²⁵) additions and binary comparisons, representing a marked improvement over Dantzig's 1960 algorithm (n³ + O(n²logn)). This improvement is achieved within a computational model where addition and comparison are the only permitted operations on path costs. This work directly addresses a significant unresolved issue highlighted by Bloniarz in 1983 regarding the complexity inherent in solving the all-pairs shortest path problem. The research emphasizes the practical implications, suggesting that the ability to process problems of size 200 within a one-second time limit could significantly influence hardware purchasing decisions for programmers. The cost metric is generalized beyond simple monetary value, encompassing various resource constraints like travel time, airport taxes, or even psychological factors associated with travel steps or points traversed.

2. Algorithm Analysis and Runtime Complexity

The research undertakes a comprehensive analysis of the proposed algorithms, exploring variations and their influence on computational complexity. Two initially promising heuristics are shown to negatively impact runtime performance. However, a revised algorithm variation achieves a significant reduction in worst-case running time, achieving O(n³). This improvement makes the new method competitive with established O(n³) algorithms such as Dijkstra's algorithm (1959) and the Floyd-Warshall algorithm. The analysis leverages the random access machine model (Aho et al., 1974), where arithmetic, logical, and indexing operations are assumed to take unit time. This abstraction simplifies the analysis by focusing on the dominant components of runtime: additions and comparisons of path costs, excluding less computationally expensive indexing operations. The rationale for this approach is that while indexing operations are consistently performed on integers within a predictable range (1 to n), addition and comparison of path costs can be considerably more complex, potentially involving high-precision floating-point numbers. The study also contrasts worst-case and average-case runtime analyses, acknowledging that while average-case analysis provides a likely scenario, individual problem instances might exhibit significantly longer runtimes.

3. Comparison with Existing Shortest Path Algorithms

The research conducts a detailed comparison of the newly developed algorithms with established shortest path algorithms, including those by Dial (1969), Dantzig (1960), Fredman (1976), and Yao et al. (1977). Dial's algorithm, using bucket sorting, optimizes Dijkstra’s algorithm for integer edge costs within a limited range. Dantzig’s algorithm, similar to Dijkstra’s, is analyzed for comparison. Fredman's work demonstrates a sufficient O(n²⁵) operation bound, establishing an upper limit for the lower bound. Yao et al.'s attempt to establish a lower bound of Ω(n²logn) using information-theoretic techniques is noted. The paper also considers the work of Graham et al. (1980), who disputed Yao's claim. Spira and Pan (1975) showed that (n-1)(n-2) operations are needed on a complete graph, even with a relaxed computational model. The paper emphasizes that, for practical applications, the average-case methods of Spira et al. (1973) outperforms algorithms with good worst-case behavior. The O(n³) algorithms are deemed to be of more theoretical rather than practical interest. Moffat's (1983) computational survey supports this conclusion, highlighting the practical superiority of fast average-case methods. The limitations of the analyses are highlighted, acknowledging the influence of factors like computer architecture, compiler, programming language, and operating system on actual runtime performance.

II.Algorithm Variations and Heuristic Analysis

Several variations of the proposed shortest path algorithms are analyzed. The study reveals that two superficially promising heuristics negatively impact runtime. Conversely, a third variation achieves a worst-case running time of O(n³), improving efficiency. The research meticulously examines the trade-offs between different approaches within the context of algorithmic complexity.

1. Impact of Heuristics on Algorithm Performance

The research investigates the effects of different heuristics on the efficiency of the proposed algorithms for solving the all-pairs shortest path problem. The analysis reveals that two heuristics, while initially appearing beneficial, negatively impact the overall running time. This highlights the importance of careful heuristic selection in algorithm design. The study doesn't delve into the specifics of these heuristics, only noting their detrimental effect on performance. The focus remains on the quantitative impact these heuristics have on computational efficiency. The results emphasize that seemingly intuitive optimizations can unexpectedly reduce algorithmic efficiency. This section serves as a cautionary tale highlighting the need for rigorous analysis of proposed optimizations, even if they appear intuitively sound. The research underscores the importance of carefully considering the potential trade-offs involved before implementing any heuristic optimization. This rigorous examination forms a crucial part of the overall evaluation and comparison of the proposed algorithm variations.

2. Algorithm Optimization Achieving O n³ Runtime

A significant finding in the research is the development of an optimized algorithm variation that achieves a worst-case running time of O(n³). This improvement is noteworthy because it brings the algorithm's performance in line with well-established classical algorithms, such as Dijkstra's algorithm and the Floyd-Warshall algorithm, which also have O(n³) complexity. The optimized algorithm, by reducing the worst-case running time, significantly enhances its practical applicability. The research does not detail the specific optimizations implemented to achieve this O(n³) complexity, focusing instead on the overall impact on performance. Achieving this level of runtime efficiency makes the new algorithm a compelling alternative to existing approaches, especially for applications requiring rapid processing of large datasets. This section emphasizes the practical significance of algorithm optimization, highlighting how targeted changes can dramatically improve computational efficiency and competitiveness with existing state-of-the-art algorithms.

III.Comparison with Existing Algorithms Dijkstra s and others

The paper benchmarks the proposed algorithms against existing methods, including different implementations of Dijkstra's algorithm (e.g., using Fibonacci heaps). It discusses algorithms by Dial (1969), Dantzig (1960), Fredman (1976), and Yao et al. (1977), analyzing their respective strengths and weaknesses in terms of worst-case and average-case performance. The implications of negative arcs and the influence of factors like computer architecture and compiler optimization on running times are also addressed. A key focus is on the comparison of average-case methods with those demonstrating strong worst-case behavior.

1. Dijkstra s Algorithm and its Variants

The research compares the newly proposed algorithms with Dijkstra's algorithm, a cornerstone in shortest path computation. The comparison extends to various implementations of Dijkstra's algorithm, such as those utilizing Fibonacci heaps (Fredman and Tarjan, 1984), highlighting the impact of data structures on efficiency. The analysis notes that while many implementations of Dijkstra's algorithm achieve excellent average-case performance, the paper focuses on evaluating and improving worst-case performance, a key area where the new algorithms aim for improvement. The study also acknowledges the limitation of Dijkstra's algorithm and its variants in handling graphs with negative edge weights, where a preprocessing step is needed (Johnson, 1973). The comparison serves to contextualize the performance of the new algorithms, demonstrating their competitiveness in terms of runtime complexity, particularly in achieving a worst-case O(n³) time bound, comparable to the performance of Dijkstra's algorithm for certain graph types. The paper highlights how the choice of data structure and the presence of negative weights can significantly influence the overall efficiency of the shortest path calculation.

2. Other Relevant Algorithms and their Performance

Beyond Dijkstra's algorithm, the research considers other relevant algorithms from the literature. This includes Dial's algorithm (1969), which uses bucket sort to efficiently implement Dijkstra's algorithm for integer edge costs within a small range. The algorithm of Dantzig (1960), similar to Dijkstra's algorithm, is also mentioned for comparative purposes. Fredman's (1976) work demonstrating sufficient O(n²⁵) operations is referenced in establishing lower bounds. The research also discusses the work of Yao et al. (1977) and their attempt to show a lower bound of Ω(n²logn), which was later refuted by Graham et al. (1980). The findings of Spira and Pan (1975) are incorporated, indicating that (n-1)(n-2) active operations are required on a complete graph, even with a more permissive computational model. The paper contrasts the theoretical interest in O(n³) algorithms with the practical advantages of faster average-case methods like those from Spira et al. (1973). Moffat's (1983) survey further supports the practical superiority of these average-case methods over their O(n³) counterparts, including Fredman’s algorithm, despite the lack of reported implementations for the latter. The extensive comparison aims to place the contributions within the broader context of shortest path algorithm development, highlighting both theoretical and practical considerations.

3. Practical Considerations and Limitations

The research acknowledges the significant influence of various factors on algorithm performance beyond theoretical complexity analysis. These include the specific computer architecture, the compiler and programming language used, and the operating system's timing facilities. The paper notes that even with careful controls, unconscious bias in experimental design could introduce subtle inaccuracies. The practical implications of these factors are particularly relevant when comparing algorithms for real-world applications. For instance, the decision of whether to choose between algorithms with comparable theoretical complexity (like O(n³)) often depends on practical aspects like average-case performance, memory usage, and ease of implementation. The research emphasizes that running times are highly volatile and depend heavily on the hardware and software environment. Therefore, while theoretical analysis is crucial, it must be complemented with practical testing and evaluation to fully assess an algorithm's suitability for specific applications. The paper implicitly advocates for a balanced approach, combining theoretical understanding with real-world experimental validation when evaluating the effectiveness of algorithms.

IV.Spira s Algorithm and Improvements

This section delves into Spira's algorithm (1973), a foundation for the new fast average-time algorithm. It provides an overview of Dantzig's single-source algorithm and a detailed explanation of Spira's approach. The analysis focuses on average running time on complete graphs. Improvements to Spira's algorithm by Bloniarz (1980) and Takaoka and Moffat (1980) are discussed, along with the concept of 'cost compression' and its impact on performance. The analysis examines the trade-offs between heap building and heap maintenance, particularly concerning the efficiency of heap cleaning stages within the algorithm. Key aspects include the effectiveness of 'unlimited scanning' and the impact on computational complexity.

1. Overview of Spira s Algorithm 1973

This section provides a foundation for understanding the new algorithm by examining Spira's 1973 algorithm, a significant precursor to the research's contributions. The paper gives a brief overview of Dantzig's single-source shortest path algorithm (1960), which forms a conceptual basis for Spira's work. Spira's algorithm, one of the earliest fast average-time algorithms for the all-pairs shortest path problem, is then described in detail. The analysis focuses on the average running time on complete graphs, providing a benchmark for comparison with the newly developed methods. The description emphasizes the shortest path searching paradigm introduced by Dantzig and later refined by Spira. This section is crucial for understanding the context and evolutionary path of the improved algorithms presented in the research. The analysis of Spira's work lays the groundwork for appreciating the advancements and optimizations incorporated in the new algorithms presented within the thesis. The selection of complete graphs for the average running time analysis is highlighted and should be considered when interpreting the results.

2. Improvements and Optimizations Bloniarz Takaoka and Moffat

The research discusses improvements made to Spira's algorithm by Bloniarz (1980), Takaoka, and Moffat (1980). These improvements focus on optimizing the heap management within the algorithm. Bloniarz's contribution includes an 'unlimited scanning' technique, where multiple edges are examined during heap operations, aiming to find a 'clean' candidate—one that leads to an unlabelled vertex. This optimization aims to reduce the computational overhead associated with heap cleaning. The paper notes that Bloniarz's method, while offering asymptotic improvements, can be slower than a simpler 'take-the-next-edge' strategy. The analysis delves into the concept of 'heap cleaning' stages, explaining how these stages involve purging edges leading to already labelled vertices and replacing labelled candidates in the heap with unlabelled ones. The optimal frequency of heap cleaning is explored, balancing the benefit of maintaining heap structure with the overhead incurred by cleaning. The research uses the example of a complete graph and the probability of success (1/logn) to illustrate the trade-offs involved in this optimization. The cumulative effects and computational costs of these improvements are examined, highlighting how certain strategies can create ‘spurious edges’ and increase runtime

3. Cost Compression and its Ineffectiveness

The concept of 'cost compression' is introduced as a potential strategy to speed up algorithms within the Spira class. This involves using shortest path costs already discovered instead of the original edge weights. It is shown that this strategy, while seeming intuitively beneficial, actually introduces spurious low-cost edges, leading to a substantial increase in processing time. The section proves that this technique offers no significant runtime advantage and is detrimental to performance. The analysis highlights the counterintuitive effects of this optimization strategy, showcasing how seemingly sound enhancements can negatively impact overall efficiency. The research emphasizes that cost compression does not offer any positive benefits and can significantly harm overall algorithm performance. The strategy’s harmful effects are more pronounced when solving the last few single-source shortest path problems, making this a crucial factor to consider when selecting optimization approaches.

V.Experimental Results and Algorithm Comparison

The study presents experimental results comparing the proposed algorithm with other methods, including Bloniarz's algorithm. The experiments were conducted on a Digital Equipment VAX 11/785 using a DEC Pascal compiler. The results show that the new algorithm consistently outperforms Bloniarz's algorithm, although the difference is relatively small (around 10%). The impact of various techniques like sorting strategies (including the use of quicksort) and the effect of 'cost compression' are examined. The analysis considers the limitations of the experimental setup and the statistical significance of the findings. The research demonstrates the practical superiority of the fast average-case methods over the O(n³) algorithms.

1. Experimental Setup and Methodology

The experimental evaluation involved implementing the new algorithm (cc-Fast-ssp) and comparing its performance with a variant (Fast-ssp) described in chapter 4.5 and Bloniarz's algorithm. The algorithms were written in Pascal, compiled using a DEC Pascal compiler under VMS on a Digital Equipment VAX 11/785, with range checking disabled. Bloniarz's algorithm's implementation was derived by modifying the source code for the new algorithm, effectively removing the heap cleaning stages and making minor adjustments to the edge-skipping procedure. The experimental methodology ensured that both algorithms were otherwise identical, allowing for a fair and direct performance comparison. The running times recorded did not include the time taken for initial sorting (presort), indicating the researchers concentrated only on the time taken by the core algorithms during experimentation. The use of the VAX 11/785, a specific computer model, is notable in providing context to the results. Note that the limitations of the system (memory) meant that only limited tests on the size 'n' were possible.

2. Comparison with Bloniarz s Algorithm

The experimental results demonstrate that the new algorithm consistently outperforms Bloniarz's algorithm in terms of running time. However, the performance difference is relatively small, approximately 10%, with standard deviations of 5% in recorded measurements for both algorithms. This indicates that while statistically significant differences in the results are limited, there's no clear indication that the new algorithm is inferior. The fact that the difference is relatively small and the standard deviations are high suggests that further experimentation might be needed to draw definitive conclusions about the practical superiority of either algorithm. The similar running times are attributed to the range of 'n' values tested falling within a specific zone of the iloglog(n) function (3 heap cleanings per source) , a zone in which the step function log*n is also 3. The observation of comparable performance is presented in contrast to the theoretical analysis which indicates that the new algorithm is superior. The limitations imposed by available memory constraints in the experimental setup are highlighted; larger values of 'n' could provide more decisive results.

3. Impact of Unlimited Scanning and Cost Compression

The research investigated the impact of additional strategies on algorithm performance. Bloniarz, Takaoka, and Moffat's asymptotic improvement of Spira's algorithm through unlimited scanning is analyzed. Unlimited scanning involves examining multiple edges when looking for a 'clean' candidate, in contrast to Spira's simpler approach. The experiments considered the effect of 'cost compression,' where already-computed shortest path costs are used in subsequent calculations. The results show that cost compression significantly worsens the running time, growing rapidly compared to the standard algorithm, providing strong empirical support for the theoretical claim that this strategy should be avoided. This section focuses on the experimental verification of theoretical insights regarding heuristic choices. The cumulative effect of cost compression, impacting the solution of the final single-source shortest path problems the most, is noted. This section validates the theoretical analysis by demonstrating empirically that certain strategies, although intuitively appealing, can severely impact overall performance. The research shows that some approaches might be theoretically beneficial but practically detrimental.