From: Jal on
Hi guys,
I am trying to find the adjacency matrix for a graph A=(aij) which is constructed through this rule:

aij=
1 ,if there is an edge connecting Pj to Pi.
0 .otherwise.
The graph has ten 10 vertices : P1,P2,....,P5. So, the dimension of the matrix is 10x10.

>> clear
>> n=5; % n= no. of vertices.
>> A=zeros(n,n) % preallocatation of the matrix.

A =

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

>> % if there is an edge connecting Pj to Pi, then aij=1, otherwise Pij=0
---I need to wrtie the rule to find the elements of the amtrix which either 1 or 0.
Thanks for your help