Title: Exercise 1'1: Adjacency matrix
1Exercise 1.1 Adjacency matrix
gtgt load classnet_cleaned.txt gtgt
size(classnet_cleaned) ans 32 11 gtgt
Azeros(32,32) gtgt for i132, for j211, if
classnet_cleaned(i,j)gt0, A(i,classnet_cleaned(i,j)
)1 end end end gtgt directed_edgessum(sum(A))
directed_edges 133 gtgt AAA ifind(Agt0)
A(i)1 lt-- all non-zero elements to 1 gtgt
undirected_edgessum(sum(A))/2 lt-- each edge
appears twice undirected_edges 82
2Exercise 1.1 Adjacency matrix
- Reciprocity
- one possible definition
- R ( of vertex pairs with links both ways) /
( of linked vertex pairs) - (ED EU)/EU
- ED/EU-1
- (ED number of edges in the directed network,
EUnumber of links in the undirected network
where aij1 if i knows j, j knows i or both.) - In this example network, R 0.6220
3Exercise 1.2 Clustering coeff
gtgt ksum(A,2) the degree of each vertex gtgt
t0.5diag(AAA) gtgt c0 N0 gtgt for
i1length(k), if (k(i)gt1), NN1
cc2t(i)/(k(i)(k(i)-1)) end end gtgt
clusteringc/N clustering 0.4948
4Exercise 1.3 Visualization