%*** input graph adjacency matrix G and nodal coordinates (for visualisation): % [G,XY] = getgraph; % creation d'un graph test %[G,XY] = getgraphTree(9); % creation de la matrice d'adjacence "arbre" %[G,XY] = getgraphBus(9); % creation de la matrice d'adjacence "bus" %[G,XY] = getgraphRing(9); % creation de la matrice d'adjacence "anneau" %[G,XY] = getgraphDoublering(9); % creation de la matrice d'adjacence "double anneau" %[G,XY] = getgraphStar(9); % creation de la matrice d'adjacence "étoile" [G,XY] = getgraphDoublestar(9); % creation de la matrice d'adjacence "double étoile" %[G,XY] = getgraphTrianglemesh(9); % creation de la matrice d'adjacence "triangle mesh" %[G,XY] = getgraphRhomboidmesh(9); % creation de la matrice d'adjacence "triangle mesh" %*** nnod: number of nodes, nseg: number of segments: nnod = size(G,1); nseg = nnz(G)/2; G(1,9)=1;G(9,1)=1; %*** same volume of data (=1) is sent from all nodes to all nodes (equipotential): STraffic = 0*G; clients = [800000 400000 50000 200000 50000 50000 50000 50000 50000] % For all STraffic = 0*G; for nfrom = 1:nnod for nto = 1:nnod if (nfrom ~= nto) [Paths,S] = gettraffic(G,nfrom,nto); S = S * 0.025 * 0.0001 * clients(nfrom) * clients(nto)/2000000; STraffic = STraffic + S; end; end; end; %--- STraffic(i,j) = t, the edge i <--> j transmitted (t) units of data, overall %*** visualize graph and traffic: figure; clf gplot(G,XY); [i,j,k] = find(triu(STraffic)); EXY = 0.3*XY(i,:) + 0.7*XY(j,:); tx1=text(EXY(:,1),EXY(:,2),num2str(k,'%3.2f')); [i,j,k] = find(triu(STraffic')); EXY = 0.3*XY(j,:) + 0.7*XY(i,:); tx2=text(EXY(:,1),EXY(:,2),num2str(k,'%3.2f')); hold on tx3 = text(XY(:,1),XY(:,2),num2str((1:nnod)')); set(tx1,'FontSize',18) set(tx2,'FontSize',18) set(tx3,'FontSize',18) set(tx3,'Color','r') axis equal axis off %**** calculate length [lengthNet] = getlength(G,XY,nnod); hold on, ti=title(strcat('length: ',num2str(lengthNet),'; telephony traffic')); set(ti,'FontSize',16);