31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• to compute maximum and minimum weighted matchings in bipartite graph,<br />

• to check the optimality of matchings, and<br />

• to scale edge weights, so as to avoid round-off errors in computations with the<br />

number type double.<br />

All functions for computing maximum or minimum weighted matchings provide a proof<br />

of optimality in the form of a potential function pot; see the chapter on bipartite weighted<br />

matchings of the <strong>LEDA</strong> book for a discussion of potential functions.<br />

<strong>The</strong> functions in this section are template functions. <strong>The</strong> template parameter NT can be<br />

instantiated with any number type. In order to use the template version of the function<br />

the appropriate .h-file must be included.<br />

#include <br />

<strong>The</strong>re are pre-instantiations for the number types int and double.<strong>The</strong> pre-instantiated<br />

versions have the same function names except for the suffix _T. In order to use them<br />

either<br />

#include <br />

or<br />

#include <br />

has to be included (the latter file includes the former). <strong>The</strong> connection between template<br />

functions and pre-instantiated functions is discussed in detail in the section “Templates<br />

for Network Algorithms” of the <strong>LEDA</strong> book. <strong>The</strong> function names of the pre-instantiated<br />

versions and the template versions only differ by an additional suffix _T in the names of<br />

the latter ones.<br />

Special care should be taken when using the template functions with a number type NT<br />

that can incur rounding error, e.g., the type double. <strong>The</strong> section “Algorithms on Weighted<br />

Graphs and Arithmetic Demand” of the <strong>LEDA</strong> book contains a general discussion of this<br />

issue. <strong>The</strong> template functions are only guaranteed to perform correctly if all arithmetic<br />

performed is without rounding error. This is the case if all numerical values in the input<br />

are integers (albeit stored as a number of type NT ) and if none of the intermediate<br />

results exceeds the maximal integer representable by the number type (2 53 − 1 in the<br />

case of doubles). All intermediate results are sums and differences of input values, in<br />

particular, the algorithms do not use divisions and multiplications.<br />

<strong>The</strong> algorithms have the following arithmetic demands. Let C be the maximal absolute<br />

value of any edge cost. If all weights are integral then all intermediate values are bounded<br />

by 3C in the case of maximum weight matchings and by 4nC in the case of the other<br />

matching algorithms. Let f = 3 in the former case and let f = 4n in the latter case.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!