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_edgeTable2topologyMat(edgeTable)
% trans_edgeTable2topologyMat
% 
% Usage: [topologyMatrix] = trans_edgeTable2topologyMat(edgeTable)
%
% Abstract: This function converts a "edges matrix" in a "topology matrix". 
% We translate the information about the physical topology from a format
% "edges matrix" (matrix where each row is a link and the first and second
% column of each row are respectively the origin node and the destination 
% node) to a format "topology matrix' (matrix of 1's and 0's where each entry (i,j) 
% indicates if there is a physical link from the node i to the node j if 
% the entry is '1'.)
%
%
% Arguments:
% o	In: 
% . edgeTable(M,2): M-by-2 integer matrix. Each row is an edge (physical link 
%   or lightpath) 'm', where the first and second columns of each row are the 
%   origin node 'x' and destination node 'y' of this edge 'm' respectively and
%   M is the number of physical links or lightpaths if the network topology
%   is physical or virtual respectively.
%
% o	Out: 
%  topologyMatrix(NxN): N-by-N integer matrix. Graph of the network topology 
%   (physical topolgy of links or vurtual topology of edges) of nodes and edges, 
%   where N is the number of nodes. As entry (i,j) is the number of edges existing 
%   from the node i to the node j. It is usually 1 or 0, in case of the edge exists 
%   or not respectively. As agreement the values of main diagonal are established to 0.
%


function [topologyMatrix] = trans_edgeTable2topologyMat(edgeTable)

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

numberOfNodes=max(max(edgeTable));
numberOfEdges=size(edgeTable,1);

topologyMatrix=zeros(numberOfNodes, numberOfNodes);
for i=1:numberOfEdges,
    topologyMatrix(edgeTable(i,1), edgeTable(i,2))=1;
end

Contact us at files@mathworks.com