From cd319a587a14fa21ccd2d03a67344c03dd233b33 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 15 May 2009 22:43:49 -0700 Subject: [PATCH] Added example to clustercoeffs --- clustercoeffs.m | 9 +++++++-- test/test_examples.m | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/clustercoeffs.m b/clustercoeffs.m index 115868a..5de2482 100644 --- a/clustercoeffs.m +++ b/clustercoeffs.m @@ -8,11 +8,16 @@ % control normalization and weighted computation. If normalized=0 or % false, then the computation is not normalized by d*(d-1) in the % unweighted case. If weighted=0 or false, then the weights of the matrix -% A are ignored. +% A are ignored. Either parameter will assume it's default value if you +% specify an empty matrix. % % See also DIRCLUSTERCOEFFS % % Example: +% load_gaimc_graph('clique-10'); +% cc = clustercoeffs(A) % they are all equal! as we expect in a clique + +% TODO Example if ~exist('normalized','var') || isempty(normalized), normalized=true; end if ~exist('weighted','var') || isempty(weighted), weighted=true; end @@ -37,7 +42,7 @@ end n=length(rp)-1; -cc=zeros(n,1); ind=false(n,1); cache=zeros(n,1); degs=zeros(n,1); +cc=zeros(n,1); ind=false(n,1); cache=zeros(n,1); ew=1; ew2=1; for v=1:n for rpi=rp(v):rp(v+1)-1 diff --git a/test/test_examples.m b/test/test_examples.m index 0b3e58a..196ade0 100644 --- a/test/test_examples.m +++ b/test/test_examples.m @@ -2,6 +2,11 @@ load_gaimc_graph('bfs_example.mat') % use the dfs example from Boost d = bfs(A,1) +%% clustercoeffs +load_gaimc_graph('clique-10'); +cc = clustercoeffs(A) % they are all equal! as we expect in a clique + + %% dfs load_gaimc_graph('dfs_example.mat') % use the dfs example from Boost d = dfs(A,1)