### Highlights from Dijkstra's Greedy Routing Algorithm

1.85714
1.9 | 15 ratings Rate this file 12 Downloads (last 30 days) File Size: 3.53 KB File ID: #5543 Version: 1.0

# Dijkstra's Greedy Routing Algorithm

22 Jul 2004 (Updated )

A routing algorithm to compute the shortest path between nodes.

File Information
Description

This time it's a well commented program for better understanding.

MATLAB release MATLAB 6.5 (R13)
Other requirements nopes
04 May 2016 Inam Khan

### Inam Khan (view profile)

Hi
I am Inam Ullah Khan from Pakistan.I have BS(Computer Science) 4 years degree and nw a days doing MS(Electronic Engineering) and my research area is Route Optimization with Ant Colony Optimization and in Route optimization i am using Bellman ford, Brute Force and Dijikstra Algorithm.And i need comparison graphs in terms of time and delay.
Best Regards
Inam Ullah Khan
inamullahkhan05@gmail.com

Comment only
17 May 2008 sweety swa

You should improve it. It is so basic !!!
And works only for 26 node

15 Oct 2007 Abdul-Kareem A. R. Shukri Alam

Hi;
I am Abdul-Kareem from Iraq. I have BSc in computer since and BSc in electrical engineering. Now I am student in computer engineering to get MSc degree in Information Technology engineering. My research is "Design and Implementation a Multicast Routing Algorithm for a Network".
Best regards.
Abdul-Kareem

Comment only
05 Apr 2007 Debabrata Nag

The key concept for dijkstra algorithm is Relaxation.While the code does the initialization and selection the relaxation part is wrongly done as it requires comparison between the current value at a node and that obtained by relaxation......just simply changing the value in iterations leads nowhere........

20 May 2005 Graeme Doole

This algorithm is an incorrect formulation of the Dijkstra method.

02 May 2005 Sungkwan Youm

this implementation is wrong, the code must be improved.

07 Jan 2005 Qing Lee

This is dijkstra algorithm?

06 Dec 2004 Andre Jellema

I think Dijkstra's algorithm is implemented wrongly

26 Oct 2004 Milena Vasquez

very good

26 Aug 2004 Vann Hills

Funny implementation!

11 Aug 2004 Brown Zu

This code is so confusing. It should not be titled as "Dijkstra routing". It seems that the author doesn't know what routing is, and what Dijkstra algorithm is.

11 Aug 2004 Brown Zu

This code is so confusing. It should be titled as "Dijkstra routing". It seems that the author doesn't know what routing is, and what Dijkstra algorithm is.

30 Jul 2004 Tim Benhart

It is interesting to compare the two implementations of Dijkstra routing here. I borrow some codes from the other one, and shows the route found using this code. It clearly shows that this code doesn't work.

clear;
noOfNodes = 50;
rand('state', 0);
figure(1);
clf;
hold on;
L = 1000;
R = 200; % maximum range;
netXloc = rand(1,noOfNodes)*L;
netYloc = rand(1,noOfNodes)*L;
for i = 1:noOfNodes
plot(netXloc(i), netYloc(i), '.');
text(netXloc(i), netYloc(i), num2str(i));
for j = 1:noOfNodes
distance = sqrt((netXloc(i) - netXloc(j))^2 + (netYloc(i) - netYloc(j))^2);
if distance <= R
matrix(i, j) = 1; % there is a link;
line([netXloc(i) netXloc(j)], [netYloc(i) netYloc(j)], 'LineStyle', ':');
else
matrix(i, j) = inf;
end;
end;
end;

activeNodes = [];
for i = 1:noOfNodes,
% initialize the farthest node to be itself;
farthestPreviousHop(i) = i; % used to compute the RTS/CTS range;
farthestNextHop(i) = i;
end;

n = noOfNodes

for p=1:n
a(p).status=0;
end

temp=[];
acc=[];
% Taking input from user regarding source & destination nodes

s = 1
d = 15;

% converting source node to status PERMANANT
a(s).status=1;
path=s;

% disp('Source and Destination are Same');
% continue
% end

% Main algorithm of Greedy Dijkstra
for k=1:inf
for h=1:n
if a(h).status==0 % If Unknown
else
temp=[temp inf];
end
end
[aa,bb]=min(temp);
acc=[acc aa];
temp=[];
s=bb;
a(s).status=1;
path=[path s];
if s==d
break
end
end

path

if length(path) ~= 0
for i = 1:(length(path)-1)
line([netXloc(path(i)) netXloc(path(i+1))], [netYloc(path(i)) netYloc(path(i+1))], 'Color','r','LineWidth', 0.50, 'LineStyle', '-.');
end;
end;
hold off;
return;

Comment only
30 Jul 2004 Clive Loyld

I have tried it and it woked pretty ok, but author should have done one thing, nodes weights are taken as [A][B] etc while source and destination are taken as 1, 2, , u improve it, but still it works fine

29 Jul 2004 Bunzo Akamatsu

Agree. This implementation is really funny! I can't see where routing is performed.
There are bunch of codes on routing on Internet. The author at least should take a look at other implementations.
http://renaud.waldura.com/doc/java/dijkstra/

28 Jul 2004 Avinash Jain

This code cannot do routing at all.
I input the weights, but the program did not return anything.
I do not think by just choosing the closest neighbor can do routing.
Please tell me if I am wrong.