I've found code online to find the clustering coefficients from the adjacency matrix, and i'm trying to understand how it works. So deg and cn are column vectors, but i don't understand what cn(deg>1) or deg(deg>1) actually means. thanks

조회 수: 17 (최근 30일)
deg = sum(graph, 2); %Determine node degrees cn = diag(graph*triu(graph)*graph); %Number of triangles for each node
%The local clustering coefficient of each node c = zeros(size(deg)); c(deg > 1) = 2 * cn(deg > 1) ./ (deg(deg > 1).*(deg(deg > 1) - 1));

답변 (1개)

Arun Mathamkode
Arun Mathamkode 2018년 4월 20일

This is basically logical indexing. deg>1 returns a logical matrix of size deg with value 1 at coordinates where deg>1 condition is satisfied. This logical matrix then can be used for logical indexing. You refer the following blog for more details.

https://blogs.mathworks.com/loren/2013/02/20/logical-indexing-multiple-conditions/

카테고리

Help CenterFile Exchange에서 3-D Scene Control에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by