Purchase Solution

# parent array produced by Dijkstra's algorithm

Not what you're looking for?

Here is a proposed algorithm to solve the single source shortest paths problem in a weighted directed graph G with possibly negative edges weights, but no negative weight cycles:
Form the graph G' from G by adding the same positive number, p, to all of the edge weights in the graph. This positive number should be chosen so that all the edge weights in G' are positive. (p = 1 + | min edge weight in G|). Run Dijkstra's algorithm on G'.

Is it true that the parent array produced by Dijkstra's algorithm on G' will also give the shortest paths in the original graph, G? Justify your answer with a counterexample or a sketch of a correctness proof.

##### Solution Summary

A parent array produced by Dijkstra's algorithm is debated.

##### Solution Preview

It does not always work :

Consider a graph with 5 vertices, A, B, C, D and ...

##### C# variables and classes

This quiz contains questions about C# classes and variables.

##### Javscript Basics

Quiz on basics of javascript programming language.

##### Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

##### Basic Networking Questions

This quiz consists of some basic networking questions.

##### Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.