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_topologyMat2edgeTable(topologyMatrix)
% trans_topologyMat2edgeTable
%
% Usage: [edgeTable] = trans_topologyMat2edgeTable(topologyMatrix)
%
% Abstract: This function converts a "topology matrix" in a "edges matrix".
% We translate the information about the physical topology from 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'.) to 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).
%
% Arguments:
% o In:
% 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.
%
% o Out:
% . 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.
function [edgeTable] = trans_topologyMat2edgeTable(topologyMatrix)
if (nargin==0), help trans_topologyMat2edgeTable;return, end %help calling
if (nargin~=1), error('1: Incorrect number of arguments.'),end %Number of input arguments different of 1
[destinationNode originNode]=find(topologyMatrix'>0);
edgeTable=[originNode destinationNode];