# How can i convert to the undirected matrix to an directed matrix?

Here A square matrix and first figure(AU) shows undirected connection graph and second one shows directed one.Assume that only i have Au metrix and how can i create Ad metrix from Au matrix in matlab?

-

If you have the possibility to change the direction of your vectors, take the upper triangular minus the lower triangular:

AD=triu(AU)-tril(AU)


And if you do not want the -1 elements, add

AD(AD==-1)=0


This will direct all your vectors from the smaller to the greater number: 1->2, 2->3, etc ...

-
for i=1:N AD( i, AU(randperm(length(AU))) ) = 1; end yes i thought it also but then matrix is not irreducible(strongly connected) as first row (or column)= 0 –  Toto Apr 16 '13 at 11:38
@Toto: You've already wasted my time by changing the question once (twice if you count the inclusion of Matlab). Now you want to waste Jonas' time by changing it again? –  Douglas S. Stones Apr 18 '13 at 16:03