The MCFClass Project
Compile-time switches in SPTree.h

These macros control some important details of the implementation. More...

Macros

#define LABEL_SETTING   1
 This macro decides which SPT algorithm has to be used.
 
#define HeapCard   2
 Number of sons of each node in the heap.
 
#define ORDRD_NMS   1
 Decides if arc names in MCFGetX() are ordered.
 
#define DYNMC_MCF_SPT   0
 Decides if the graph topology (arcs, nodes) can be changed.
 

Detailed Description

These macros control some important details of the implementation.

Although using macros for activating features of the implementation is not very C++, switching off some unused features may make the code more efficient in running time or memory.

Macro Definition Documentation

◆ LABEL_SETTING

#define LABEL_SETTING   1

This macro decides which SPT algorithm has to be used.

Possible values are:

  • 0 => LQueue
  • 1 => LDeque
  • 2 => (currently unused)
  • 3 => Dijkstra
  • 4 => Heap

For algorithms based on priority lists, the macro LABEL_SETTING [see below] can be set to 1 to say that the algorithm is of the "label-setting" (nodes only exit from Q once) rather than of the "label-correcting" (nodes may exit from Q more than once) type. This macro decides if the "label-setting" style is used.

With a priority lists, the SPT algorithm applied to SPT problems with all nonnegative arc costs has the "label-setting" property: nodes only exit from Q once, hence when a node exits from Q its label is permanently set.

If LABEL_SETTING > 0 the code will assume that this property holds and implement some things accordingly; in particular, the algorithm is terminated when the last destination is extracted from Q even though Q is still nonempty.

Warning
Solving a SPT algorithm with negative arc costs with LABEL_SETTING > 0 may produce a suboptimal solution.

◆ HeapCard

#define HeapCard   2

Number of sons of each node in the heap.

SPT_ALGRTM == 4 means using a C-ary heap to hold the node set Q: each HeapCard is the ariety of the heap, i.e. the max number of sons of a node in the heap. Special treatment is deserved to the case HeapCard == 2.

◆ ORDRD_NMS

#define ORDRD_NMS   1

Decides if arc names in MCFGetX() are ordered.

If ORDRD_NMS > 0, and MCFGetX() [see below] is asked for a "sparse" flow solution (i.e., nms != 0), then the set of indices returned at the end of the method is ordered in increasing sense. If ORDRD_NMS == 0 instead, the set of indices may not be ordered.

ORDRD_NMS > 0 may be useful for some applications, but it is more costly (basically, it requires either to compute the "dense" flow solution or to sort a vector). Also, "sparse" flow solutions in this class are guaranteed to contain no more than n - 1 nonzeroes, hence if ORDRD_NMS == 0 then the parameter ‘F’ in MCFGetX( F , nms ) can actually point to a (n - 1)-vector, while if ORDRD_NMS > 0 it must point to a m-vector anyway.

◆ DYNMC_MCF_SPT

#define DYNMC_MCF_SPT   0

Decides if the graph topology (arcs, nodes) can be changed.

If DYNMC_MCF_SPT > 0, some of the methods of the public interface of class that allow to change the topology of the underlying network are actually implemented. Possible values of this macro are:

  • 0 => the topology of the graph cannot be changed;
  • 1 => all the methods that change the topology of the graph are implemented.