COMPUTEPATHNUM compute pathway number of input -> output and whole block. [ ioLevelMatrix, pathNumMatrix ] = computePathNum( network, level ) This function compute pathway number of input->output block and whole block. Input: network: network structure containg 'matrix', 'inputNumber', 'outputNumber' field. level: 1 means direct link between nodes. ( = level 0 in manuscript) 2 means source -> X -> destination, X is a node. The rest can be done in the same manner. Output: ioLevelMatrix: pathway number of input -> output block. pathNumMatrix: pathway number of whole block. Below is oder of each block. ----------------------------------------------- | in -> in | in -> out | in -> inter | ----------------------------------------------- | out -> in | out -> out | out -> inter | ----------------------------------------------- | inter -> in | inter -> out | inter -> inter | -----------------------------------------------
0001 function [ ioLevelMatrix, pathNumMatrix ] = computePathNum( network, level ) 0002 % COMPUTEPATHNUM compute pathway number of input -> output and whole block. 0003 % 0004 % [ ioLevelMatrix, pathNumMatrix ] = computePathNum( network, level ) 0005 % This function compute pathway number of input->output block and whole 0006 % block. 0007 % 0008 % Input: 0009 % network: network structure containg 'matrix', 'inputNumber', 0010 % 'outputNumber' field. 0011 % level: 1 means direct link between nodes. ( = level 0 in manuscript) 0012 % 2 means source -> X -> destination, X is a node. 0013 % The rest can be done in the same manner. 0014 % 0015 % Output: 0016 % ioLevelMatrix: pathway number of input -> output block. 0017 % pathNumMatrix: pathway number of whole block. 0018 % Below is oder of each block. 0019 % ----------------------------------------------- 0020 % | in -> in | in -> out | in -> inter | 0021 % ----------------------------------------------- 0022 % | out -> in | out -> out | out -> inter | 0023 % ----------------------------------------------- 0024 % | inter -> in | inter -> out | inter -> inter | 0025 % ----------------------------------------------- 0026 0027 % --------- 0028 % Yen-Nan Lin, NTHU, 2010-2014, Matlab 2012a 0029 0030 CONNECT_MATRIX_FIELD_NAME = 'matrix'; 0031 INPUT_NUMBER_FIELD_NAME = 'inputNumber'; 0032 OUTPUT_NUMBER_FIELD_NAME = 'outputNumber'; 0033 pathNumMatrix = getfield(network, CONNECT_MATRIX_FIELD_NAME); 0034 nInput = getfield(network, INPUT_NUMBER_FIELD_NAME); 0035 nOutput = getfield(network, OUTPUT_NUMBER_FIELD_NAME); 0036 inputIx = 1:nInput; 0037 outputIx = (nInput + 1):(nInput + nOutput); 0038 for iLevel= 1:(level - 1) 0039 pathNumMatrix = pathNumMatrix * getfield(network, CONNECT_MATRIX_FIELD_NAME); 0040 end 0041 ioLevelMatrix = pathNumMatrix(inputIx, outputIx); 0042 end