Vishal, in your case, you could provide the inputs as follows:
C = zeros(4);
C(1,2) = 10;
C(1,3) = 20;
C(2,4) = 30;
C(3,4) = 40;
A = logical(C);
[cost,path] = dijkstra(A,C,1,4)
And the output you would get is:
cost =
40
path =
1 2 4

Hi,
I need to use this. I am getting confused with the input form that should be given.
For ex:
I have 4 simple nodes.
1 2 3 4
1->2: weight = 10
1->3: weight = 20
2->4: weight = 30
3->4: weight = 40
i need to find path from 1 to 4.
Can you tell me how to give input.

This function works fine.
I call it many times as dijkstra(A,C,1) into an optimization function.
Nevertheless, the Matlab profiler halt me with warnings about the use of sparse functions, and indexing sparse matrices.

Comment only