No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail
from MatPlanWDM v0.5 by Pablo Pavon MariƱo
Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

trans_flowTable2trafficMatrix(flowTable)
% trans_flowTable2trafficMatrix
% 
% Usage: [traff_trafficMatrix] = trans_flowTable2trafficMatrix(flowTable)
%
% Abstract: This function converts a "flow table" into a "traffic matrix". 
% We translate the information about the traffic flows from the first
% format to the second one. 
%
% Arguments:
% o	In: 
%  . flowTable(F,3): F-by-3 matrix. First column de ingress node, second
%    the egress node, third the traffic offered = traffic carried in Gbps.
%
% o	Out: 
%  traff_trafficMatrix(NxN): Average traffic flow offered between node pairs. The 
%   Traffic Matrix is a two-dimensional matrix with N (N: number of nodes) 
%   rows and N columns. An entry(s,d) means the average traffic flow from 
%   node 's' to node 'd', measured as the number of bits per second.
%




function [traff_trafficMatrix] = trans_flowTable2trafficMatrix(flowTable)

if (nargin==0),  help trans_flowTable2trafficMatrix;return, end %help calling
if (nargin~=1),  error('1: Incorrect number of arguments.'),end %Number of input arguments different of 1

numberOfNodes=max(max(flowTable(:,1:2)));
numberOfFlows=size(flowTable,1);

traff_trafficMatrix=zeros(numberOfNodes, numberOfNodes);
countOfRepeatedFlows=zeros(numberOfNodes,numberOfNodes);
for f=1:numberOfFlows,
    countOfRepeatedFlows(flowTable(f,1), flowTable(f,2))=...
        countOfRepeatedFlows(flowTable(f,1), flowTable(f,2))+1;        
    traff_trafficMatrix(flowTable(f,1), flowTable(f,2))= ...
        (traff_trafficMatrix(flowTable(f,1), flowTable(f,2)) + flowTable(f,3))/countOfRepeatedFlows(flowTable(f,1), flowTable(f,2));
end


Contact us at files@mathworks.com