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 Center および File Exchange3-D Scene Control についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by