From: ron sith on 17 Jan 2010 00:08 %topo = [0 1 1 0 1; 1 0 0 1 1; 1 0 0 1 0; 0 1 1 0 1; 1 1 0 1 0;]; >> T=input('Topology:'); S=input('Source:'); D=input('Destination:'); k=1; j=1; u=size(T); n=u(1,1); hop=zeros(n-1,n-1); path=[S]; hop(1,1)=S; while j<=n if T(hop(k,k),j)==1 checkhop=j*eye(n-1); same = checkhop==hop; if j==D [path j] r=r+1; j=j+1; elseif trace(same)==0 k=k+1; hop(k,k)=j; path=[path j]; j=1; elseif trace(same)~=0 j=j+1; end elseif T(hop(k,k),j)~=1 j=j+1; end while j>n if k~=1 j=hop(k,k)+1; hop(k,k)=0; k=k-1; path=path(1,1:k); elseif k==1 break end end end This problem is about to find the shortest path from each node which has a source and destination. Can anybody edit a new code but have a same result ? I need a simplifly code for reading because I'm a new user of matlab.THANK YOU for help ^^
From: Rune Allnor on 17 Jan 2010 05:24 On 17 Jan, 06:08, "ron sith" <autingt...(a)hotmail.com> wrote: > This problem is about to find the shortest path from each node which has a source and destination. > Can anybody edit a new code but have a same result ? I need a simplifly code for reading because I'm a new user of matlab. Do your own homework. Rune
From: Jan Simon on 17 Jan 2010 05:58 Dear Ron! > Can anybody edit a new code but have a same result ? I need a simplifly code for reading because I'm a new user of matlab. If you cannot understand the source code in detail, I assume, it is not yours. Are you sure that the author agrees with the publication without mentioning his/her name? In my opinion, especially as a Matlab beginner you can learn a lot from this example especially without simplifying it! Good luck, Jan
|
Pages: 1 Prev: medfilt1 vs medfilt2 Next: how to fix the axis when showing the animation |