2 %> Prepares the network
for efficient access to the data
4 %> @note Tested with runPrepareNetwork.m
10 %> @note Called by \ref run2120.m
11 %> @note Called by \ref runEnumeratePaths.m
13 %> @author Michel Bierlaire
14 %> @date Fri Mar 27 17:52:24 2015
15 %> @ingroup Algorithms
18 %> Identifies the upstream and downstream nodes of each arc
19 %> @param adj the adjacency matrix of the network. It is a \f$m \times m\f$ matrix, such that the element at row i and column j corresponds to the
id of the arc (i,j). The numbering should be from 1 to n.
20 %> @
return 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.
24 if (columns(adj) != nnodes)
25 error(
"Adjacency matrix must be square") ;
27 narcs = max(max(adj)) ;
28 arcs = zeros(narcs,2) ;
32 arcs(adj(i,j),1) = i ;
33 arcs(adj(i,j),2) = j ;
function simpleCycle(in adj, in circ, in printlevel)
Extract a simple cycle flow from a circulation.
function shortestPath(in adj, in cost, in orig)
Calculate the shortest paths from one origin to all nodes.
function incidenceMatrix(in adj)
Provide the incidence matrix a a network.
function prepareNetwork(in adj)
Identifies the upstream and downstream nodes of each arc.
function dijkstra(in adj, in cost, in orig, in printlevel)
Calculate the shortest paths from one origin to all nodes using Dijkstra's algorithm.