% graphlinkpie.m
% used with readsenselabstats.m
% this program will graph the links of the network as a pie.
figure
hold on
plot(3,3), plot(-3,-3)  % points to create a reference
theta=[0 0:16]*2*pi/17;
circlex=cos(theta);
circley=sin(theta);
% move the first node to the center (the home page)
circlex(1)=0;
circley(1)=0;
%text(-.7,-1.3,'ModelDB''s home page default.asp is in the center');
if 0
    for i=2:length(node)
    s=char(node(i));
    s=[s(19:end) ' (' int2str(w(1,i)) ')'];
    if circlex(i)>0
        text(circlex(i),circley(i),s,'HorizontalAlignment','left')
    else
        text(circlex(i),circley(i),s,'HorizontalAlignment','right')
    end
    end
end

if 0
for i=1:length(node)
    if w(1,i)>0
        plot([circlex(1) circlex(i)],[circley(1) circley(i)],'LineWidth',max(w(1,i)/16,1),'Color',[0 0 0])
    end
end
end

%axis([-2 2 -1.5 1.5]);

h=pie(link_counts)
textObjs = findobj(h,'Type','text');
oldStr = get(textObjs,{'String'});
val = get(textObjs,{'Extent'});
oldExt = cat(1,val{:});
newStr = strcat(link_names',oldStr);
set(textObjs,{'String'},newStr)
colormap jet
axis off
