if destination == nextNodes(i) %输出路径
tmpPath = cat(2, partialPath, destination); %串接成一条完整的路径
tmpPath(GLength + 1) = partialWeight + Graph(lastNode, destination); %延长数组长度至GLength+1, 最后一个元素用于存放该路径的总路阻 possiablePaths( length(possiablePaths) + 1 , : ) = tmpPath; nextNodes(i) = 0;
elseif length( find( partialPath == nextNodes(i) ) ) ~= 0 nextNodes(i) = 0; end end
nextNodes = nextNodes(nextNodes ~= 0); %将nextNodes中为0的值去掉,因为下一个节点可能已经遍历过或者它就是目标节点
for i=1:length(nextNodes)
tmpPath = cat(2, partialPath, nextNodes(i));
tmpPsbPaths = findPath(Graph, tmpPath, destination, partialWeight + Graph(lastNode, nextNodes(i)));
possiablePaths = cat(1, possiablePaths, tmpPsbPaths); end
31
32