File: rstats.m

package info (click to toggle)
combblas 2.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 190,488 kB
  • sloc: cpp: 55,918; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (38 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function rstats(scales)
% RSTATS : collect stats about RMAT graphs of given sizes
%
% rstats(scales);
%
% John Gilbert, 27 Sep 2010

nb = 200;                % batch size to average over
maxd = 20;               % max distance to go out
fringe = zeros(1,maxd);  % size of fringe at given distance
fprintf('\nRMAT statistics at different scales\n');
fprintf('\nScale     Nv       Ne Diam     d1    d2    d3    d4    d5    d6    d7    d8    d9   d10\n')
for k = scales
    A = rmat(k);
    nv = length(A);
    ne = nnz(A);
    B = sparse(ceil(nv*rand(1,nb)),1:nb,1,nv,nb);
    for d = 1:maxd
        BB = A*B | B;
        F = BB - B;
        B = BB;
        fringe(d) = nnz(F);
        if fringe(d)==0
            break
        end;
    end;
    if fringe(d)==0
        nf = d-1;
        diam = d-1;
    else
        nf = d;
        diam = nan;
    end;
    
    fprintf('  %3d %6d %8d %4d ',k,nv,ne,diam);
    fprintf('%6d',round(fringe(1:nf)/nb));
    fprintf('\n');
end;