2 %> Compute the divergence of a flow vector (Definition 21.13 of \cite Bier15-book)
4 %> @note Tested with \ref runDivergence.m
7 %> @author Michel Bierlaire
8 %> @date Sun Mar 29 17:30:04 2015
12 %> Compute the divergence of a flow vector
13 %> @param adj adjacency matrix of the network
14 %> @param flow flow vector (number of entries should be equal to the number of non zero entries of the adjacency matrix)
15 %> @
return divergence of eachnode
18 if (columns(adj) != nnodes)
19 error(
"Adjacency matrix must be square") ;
22 diverg = zeros(nnodes, 1) ;
26 diverg(i) += flow(adj(i,j)) ;
27 diverg(j) -= flow(adj(i,j)) ;
function nodeDivergence(in adj, in flow)
Compute the divergence of a flow vector.
function flowDecomposition(in adj, in flow)
Decompose a flow vector into simple path flows.