Code covered by the BSD License  

Highlights from
Temporal Graph Visualization

from Temporal Graph Visualization by Anh-Dung Nguyen
Visualize the evolution of a temporal graph

visualGraph(G)
function visualGraph(G)
% This function allows to visualize the evolution of a temporal graph. The
% layout is a ring lattice.
% Inputs:
% - G: the temporal graph under form of a 3D-matrix in which the 1st and
% 2nd dimension denotes the node's IDs and the 3rd dimension denotes the
% time.
%
% Author: Anh-Dung Nguyen
% Email: nad1186@gmail.com

    l = size(G,3);
    nxNodes = size(G,1);
    [x,y,z] = cylinder(1,nxNodes);
    figure
     
    for i = 1 : l
        if rem(i*200,3600) == 0
            fprintf('%d h\n',i*200/3600)
        end
        plot(x(1,:),y(1,:),'o')
        hold on
        [n1 n2] = find(G(:,:,i)==1);
        v = unique(sort([n1 n2],2),'rows');
        
        for ii = 1:size(v,1)
            p1 = [x(1,v(ii,1)) x(1,v(ii,2))];
            p2 = [y(1,v(ii,1)) y(1,v(ii,2))];
            plot(p1,p2)
        end
       
        hold off
        getframe;
       
    end
end

Contact us