111%> @param layer list of layers. Each layer contains an array of nodes, arcs and directions.

112%> @param dest destination node to reach

113%> @param arcs A matrix containing the upstream and downstream nodes of each arc. Each row corresponds to an arc. Column 1 contains the upstream node and column 2 the downstream. Output of \ref prepareNetwork.

114%> @return path.arcs: sequence of arcs on the path

115%> @return path.dir: +1 if forward, -1 if backward

116function path = buildPathBackward(layer,dest,arcs)

117 path.arcs = zeros(0) ;

118 path.dir = zeros(0) ;

119 currentNode = dest ;

120 for i = length(layer):-1:2

121 theLayer = layer{i} ;

122 idx = find(theLayer.nodes == currentNode) ;

123 path.dir = [theLayer.dir(idx) path.dir] ;

124 path.arcs = [theLayer.arcs(idx) path.arcs] ;

125 if (theLayer.dir(idx) == 1)

126 currentNode = arcs(theLayer.arcs(idx),1) ;

127 else

128 currentNode = arcs(theLayer.arcs(idx),2) ;

129 endif

130 endfor

131endfunction

132

133%> Print the layers

134%>

135%> @note Called by \ref unsaturatedPath

136%> @param layer list of layers. Each layer contains an array of nodes, arcs and directions.

137%> @param arcs A matrix containing the upstream and downstream nodes of each arc. Each row corresponds to an arc. Column 1 contains the upstream node and column 2 the downstream. Output of \ref prepareNetwork.