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 Ansichten (letzte 30 Tage)
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));

Antworten (1)

Arun Mathamkode
Arun Mathamkode am 20 Apr. 2018

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/

Kategorien

Mehr zu 3-D Scene Control finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by