cudd  3.0.0
The University of Colorado Decision Diagram Package
Functions
ntrShort.c File Reference

Symbolic shortest paths algorithms. More...

#include "ntr.h"
#include "cuddInt.h"
Include dependency graph for ntrShort.c:

Functions

int Ntr_ShortestPaths (DdManager *dd, BnetNetwork *net, NtrOptions *option)
 Computes shortest paths in a state graph. More...
 
static DdNodentrBellman (DdManager *dd, DdNode *D, DdNode *source, DdNode **x, DdNode **y, int vars, int pr)
 Bellman-Ford algorithm for single-source shortest paths. More...
 
static DdNodentrWarshall (DdManager *dd, DdNode *D, DdNode **x, DdNode **y, int vars, int pr)
 Floyd-Warshall algorithm for all-pair shortest paths.
 
static DdNodentrSquare (DdManager *dd, DdNode *D, DdNode **x, DdNode **y, DdNode **z, int vars, int pr, int st)
 Repeated squaring algorithm for all-pairs shortest paths. More...
 

Detailed Description

Symbolic shortest paths algorithms.

This file contains the functions that implement the symbolic version of several shortest path algorithms described in the JFM paper on ADDs.

Author
Fabio Somenzi, Iris Bahar

Function Documentation

◆ Ntr_ShortestPaths()

int Ntr_ShortestPaths ( DdManager dd,
BnetNetwork net,
NtrOptions option 
)

Computes shortest paths in a state graph.

Computes shortest paths in the state transition graph of a network. Three methods are availabe:

  • Bellman-Ford algorithm for single-source shortest paths; the algorithm computes the distance (number of transitions) from the initial states to all states.
  • Floyd-Warshall algorithm for all-pair shortest paths.
  • Repeated squaring algorithm for all-pair shortest paths.
Returns
1 in case of success; 0 otherwise.
Side effects ADD variables are created in the manager.

◆ ntrBellman()

static DdNode* ntrBellman ( DdManager dd,
DdNode D,
DdNode source,
DdNode **  x,
DdNode **  y,
int  vars,
int  pr 
)
static

Bellman-Ford algorithm for single-source shortest paths.

Returns
the vector of the distances of all states from the initial states.

In case of multiple initial states the distance for each state is from the nearest initial state. Negative-weight cycles are detected, though only in the naive way. (Lack of convergence after nodes-1 iterations.) In such a case, a constant ADD with value minus infinity is returned. Bellman-Ford is based on matrix-vector multiplication. The matrix is the distance matrix D(x,y), such that D(a,b) is the length of the arc connecting state a to state b. The vector V(x) stores the distances of all states from the initial states. The actual vector used in the matrix-vector multiplication is diff(x), that holds those distances that have changed during the last update.

See also
ntrWarshall ntrSquare

◆ ntrSquare()

static DdNode* ntrSquare ( DdManager dd,
DdNode D,
DdNode **  x,
DdNode **  y,
DdNode **  z,
int  vars,
int  pr,
int  st 
)
static

Repeated squaring algorithm for all-pairs shortest paths.

Parameters
ddmanager
DD(z,y): distance matrix
xarray of x variables
yarray of y variables
zarray of z variables
varsnumber of variables in each of the three arrays
prverbosity level
stuse the selective trace algorithm