Label correcting algorithm for shortest path

Can any body provide a code for label correcting algorithm for shortest path. Thankyou!

6 comentarios

Image Analyst
Image Analyst el 26 de Mayo de 2013
Describe what the "label correcting algorithm" is.
And do you already have the shortest path, or do you still need to find it?
Walter Roberson
Walter Roberson el 26 de Mayo de 2013
It sort of sounds like there might be a known path but with something changed after it was calculated, and now the path needs to be "tweaked" to adjust to the new conditions. As a guess.
Here's the label correcting algorithm. It is similar to dijiktras algorithm except that we are maintaining the node list rather than the arc list. I am not really sure how to code this algorithm especially when we also have to keep track of the LIST.
algorithm MODIFIED LABEL CORRECTING;
begin
d(1) := 0 and Pred(1) := empty set ;
d(j) := infinity for each j in N \ {1};
LIST := {1};
while LIST is not empty do
begin
take out an element i from LIST;
for each (i,j) belong to A(i) if d(j) > d(i) + cij then
begin
d(j) := d(i) + cij ;
pred(j) := i;
if j doesnot belong to LIST then add j to LIST;
end;
end;
end
jana
jana el 27 de Mayo de 2013
Regarding the second question: Yes I still need to find the shortest path.
LIST = [1]; %initialize
...
i = LIST(1); %take out element
LIST(1) = [];
...
if ~ismember(j, LIST); LIST(end+1) = j; end %add j if it is not there
jana
jana el 28 de Mayo de 2013
thankyou! that was of great help.

Iniciar sesión para comentar.

Categorías

Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 26 de Mayo de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by