Оптимизация СМО
Автор
function flowDir(nM)
qN = size(nM, 1)
nfl = count(x -> x > 0, nM)
nl = zeros(Int, 2 * nfl)
c = 1
for a in 1:qN
for b in 1:qN
if nM[a, b] > 0
nl[2*c - 1] = a
nl[2*c] = b
c += 1
end
end
end
return reshape(nl, 2, nfl)
end