Monday, April 20, 2009

Sri Lanka on the way forward ?

I am overjoyed with excitement with the news that hopefully the whole country will be free of terrorism within a matter of few weeks. Terrorism is the single biggest reason that left our country stranded among the poorest of nations in the world.

All around the world, there are many professionals who were born and educated in this island nation, but now living in foreign countries after giving up hope for a better future for our mother land. But once this lunacy of terrorism is over, I guess we would have an environment where all the Sinhalese, Tamils, Muslims and the rest can live in harmony. Every where I look in our country, and every industry that I think about, I can only see the potential for investments and development. I always imagine a future where all of our engineers, researchers and scientists return to Sri Lanka and start building the future Sri Lanka as one country, one nation and one people.

In the mean time, I wish that our tamil brothers and sisters would understand the reality of what is actually going on. Please open your eyes, don't be shadowed by the propaganda of the terrorists. There is nothing called a 'good terrorist' and a 'bad terrorist'. Realize that there is a difference between a true 'freedom fighter' and a 'terrorist'. Listen to the true voices of the innocent people who are been taken hostage by the ruthless organization.

If anyone feel that the Sri Lankan government can't be trusted, why not listen to the international media and international representatives. Check out the following videos.




See what they are doing in other countries as well ..



Saturday, March 7, 2009

What is this credit crisis ?

Being an engineer, one thing I understand about the 'credit crisis' is that it has become very difficult to find a decent job thesedays. I sincerely hope that the situation would be better in a few months, when I graduate with my Masters degree ..

One of my friends send me the following links in youtube. It is a very interesting but simple explanation of whats going on..



It is also a very well composed presentation :). It is a part of a thesis by a guy named Jonathan Jarvis. Well done buddy. Keep'em coming.


Monday, March 2, 2009

k - Shortest, Link - Disjoint paths for Matlab


Here is a useful piece of Matlab code for anyone who needs to find a set of link disjoint paths in a given undirected graph. I couldn't find a single function in Matlab to do it, so here is my solution. It is so simple and I have used the 'graphshortespath' function which is available in the Bioinformatics toolbox. Maybe not the optimal algorithm, but does the job and it was sufficient for my purpose :)

% (c)Buddhika Gunawardena , 2009
% Filename: KShortestLinkDisjointPaths.m
% Description: A simple function to calculate k shortest and link disjoint
% paths of a given undirected graph (G) from source (src) to destination
% (dst)
% Inputs:
% G: A connectivity matrix where if (i,j) = 1, there is a link from
% node i to node j, and 0 otherwise. Here it is always a symmetric matrix.
% k : The number of paths to be calculated
% src: source node
% dst: destination node
% Outputs:
% paths: a k x NNodes matrix that shows all k paths found. NNodes is
% the number of nodes in the Graph. row in the matrix contain a single
% path from source to destination. (node numbers from source until
% destination)


function paths = KShortestLinkDisjointPaths(G,k,src,dst)

NNodes = size(G,1);

paths = zeros(k,NNodes);
for p = 1:k
[dist, path]= graphshortestpath(sparse(G), src, dst);
if (dist~=inf)
n = size(path,2);
paths(p,1:n)= path;
for i = 1:n-1
G(path(i),path(i+1))=0;
G(path(i+1),path(i))=0;
end
end
end

And here is an example of it's usage,

G = [ 0 1 1 0 ;
1 0 1 1 ;
1 1 0 1 ;
0 1 1 0 ];
k = 2;

src = 1;
dst = 4;

paths = KShortestLinkDisjointPaths(G,k,src,dst)

The simple graph used in this example is shown in figure above. And the output would be,

paths =

1 2 4 0
1 3 4 0

Cheers !

PS. I must mention the nice simple tool that I use to convert coding such that I can insert it directly in my blog. Try it yourself. Its so simple.