| ... | ... |
@@ -39,19 +39,19 @@ |
| 39 | 39 |
/// |
| 40 | 40 |
/// \brief Edmonds' alternating forest maximum matching algorithm. |
| 41 | 41 |
/// |
| 42 |
/// This class provides Edmonds' alternating forest matching |
|
| 43 |
/// algorithm. The starting matching (if any) can be passed to the |
|
| 44 |
/// |
|
| 42 |
/// This class implements Edmonds' alternating forest matching |
|
| 43 |
/// algorithm. The algorithm can be started from an arbitrary initial |
|
| 44 |
/// matching (the default is the empty one) |
|
| 45 | 45 |
/// |
| 46 |
/// The dual |
|
| 46 |
/// The dual solution of the problem is a map of the nodes to |
|
| 47 | 47 |
/// MaxMatching::Status, having values \c EVEN/D, \c ODD/A and \c |
| 48 | 48 |
/// MATCHED/C showing the Gallai-Edmonds decomposition of the |
| 49 | 49 |
/// graph. The nodes in \c EVEN/D induce a graph with |
| 50 | 50 |
/// factor-critical components, the nodes in \c ODD/A form the |
| 51 | 51 |
/// barrier, and the nodes in \c MATCHED/C induce a graph having a |
| 52 |
/// perfect matching. The number of the |
|
| 52 |
/// perfect matching. The number of the factor-critical components |
|
| 53 | 53 |
/// minus the number of barrier nodes is a lower bound on the |
| 54 |
/// unmatched nodes, and |
|
| 54 |
/// unmatched nodes, and the matching is optimal if and only if this bound is |
|
| 55 | 55 |
/// tight. This decomposition can be attained by calling \c |
| 56 | 56 |
/// decomposition() after running the algorithm. |
| 57 | 57 |
/// |
| ... | ... |
@@ -66,8 +66,7 @@ |
| 66 | 66 |
|
| 67 | 67 |
///\brief Indicates the Gallai-Edmonds decomposition of the graph. |
| 68 | 68 |
/// |
| 69 |
///Indicates the Gallai-Edmonds decomposition of the graph, which |
|
| 70 |
///shows an upper bound on the size of a maximum matching. The |
|
| 69 |
///Indicates the Gallai-Edmonds decomposition of the graph. The |
|
| 71 | 70 |
///nodes with Status \c EVEN/D induce a graph with factor-critical |
| 72 | 71 |
///components, the nodes in \c ODD/A form the canonical barrier, |
| 73 | 72 |
///and the nodes in \c MATCHED/C induce a graph having a perfect |
| ... | ... |
@@ -410,13 +409,13 @@ |
| 410 | 409 |
} |
| 411 | 410 |
|
| 412 | 411 |
/// \name Execution control |
| 413 |
/// The simplest way to execute the algorithm is to use the |
|
| 412 |
/// The simplest way to execute the algorithm is to use the |
|
| 414 | 413 |
/// \c run() member function. |
| 415 | 414 |
/// \n |
| 416 | 415 |
|
| 417 |
/// If you need |
|
| 416 |
/// If you need better control on the execution, you must call |
|
| 418 | 417 |
/// \ref init(), \ref greedyInit() or \ref matchingInit() |
| 419 |
/// functions, then you can start the algorithm with the \ref |
|
| 418 |
/// functions first, then you can start the algorithm with the \ref |
|
| 420 | 419 |
/// startParse() or startDense() functions. |
| 421 | 420 |
|
| 422 | 421 |
///@{
|
| ... | ... |
@@ -433,9 +432,9 @@ |
| 433 | 432 |
} |
| 434 | 433 |
} |
| 435 | 434 |
|
| 436 |
///\brief Finds |
|
| 435 |
///\brief Finds an initial matching in a greedy way |
|
| 437 | 436 |
/// |
| 438 |
/// |
|
| 437 |
///It finds an initial matching in a greedy way. |
|
| 439 | 438 |
void greedyInit() {
|
| 440 | 439 |
createStructures(); |
| 441 | 440 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| ... | ... |
@@ -459,7 +458,7 @@ |
| 459 | 458 |
} |
| 460 | 459 |
|
| 461 | 460 |
|
| 462 |
/// \brief Initialize the matching from |
|
| 461 |
/// \brief Initialize the matching from a map containing. |
|
| 463 | 462 |
/// |
| 464 | 463 |
/// Initialize the matching from a \c bool valued \c Edge map. This |
| 465 | 464 |
/// map must have the property that there are no two incident edges |
| ... | ... |
@@ -507,7 +506,7 @@ |
| 507 | 506 |
/// \brief Starts Edmonds' algorithm. |
| 508 | 507 |
/// |
| 509 | 508 |
/// It runs Edmonds' algorithm with a heuristic of postponing |
| 510 |
/// shrinks, |
|
| 509 |
/// shrinks, therefore resulting in a faster algorithm for dense graphs. |
|
| 511 | 510 |
void startDense() {
|
| 512 | 511 |
for(NodeIt n(_graph); n != INVALID; ++n) {
|
| 513 | 512 |
if ((*_status)[n] == UNMATCHED) {
|
| ... | ... |
@@ -538,13 +537,13 @@ |
| 538 | 537 |
/// @} |
| 539 | 538 |
|
| 540 | 539 |
/// \name Primal solution |
| 541 |
/// Functions |
|
| 540 |
/// Functions to get the primal solution, ie. the matching. |
|
| 542 | 541 |
|
| 543 | 542 |
/// @{
|
| 544 | 543 |
|
| 545 |
///\brief Returns the size of the |
|
| 544 |
///\brief Returns the size of the current matching. |
|
| 546 | 545 |
/// |
| 547 |
///Returns the size of the |
|
| 546 |
///Returns the size of the current matching. After \ref |
|
| 548 | 547 |
///run() it returns the size of the maximum matching in the graph. |
| 549 | 548 |
int matchingSize() const {
|
| 550 | 549 |
int size = 0; |
| ... | ... |
@@ -583,7 +582,7 @@ |
| 583 | 582 |
/// @} |
| 584 | 583 |
|
| 585 | 584 |
/// \name Dual solution |
| 586 |
/// Functions |
|
| 585 |
/// Functions to get the dual solution, ie. the decomposition. |
|
| 587 | 586 |
|
| 588 | 587 |
/// @{
|
| 589 | 588 |
|
| ... | ... |
@@ -645,7 +644,7 @@ |
| 645 | 644 |
/// be asked with \c matching() or mate() functions. The dual |
| 646 | 645 |
/// solution can be get with \c nodeValue(), \c blossomNum() and \c |
| 647 | 646 |
/// blossomValue() members and \ref MaxWeightedMatching::BlossomIt |
| 648 |
/// "BlossomIt" nested class which is able to iterate on the nodes |
|
| 647 |
/// "BlossomIt" nested class, which is able to iterate on the nodes |
|
| 649 | 648 |
/// of a blossom. If the value type is integral then the dual |
| 650 | 649 |
/// solution is multiplied by \ref MaxWeightedMatching::dualScale "4". |
| 651 | 650 |
template <typename _Graph, |
| ... | ... |
@@ -1630,7 +1629,7 @@ |
| 1630 | 1629 |
} |
| 1631 | 1630 |
|
| 1632 | 1631 |
/// \name Execution control |
| 1633 |
/// The simplest way to execute the algorithm is to use the |
|
| 1632 |
/// The simplest way to execute the algorithm is to use the |
|
| 1634 | 1633 |
/// \c run() member function. |
| 1635 | 1634 |
|
| 1636 | 1635 |
///@{
|
| ... | ... |
@@ -1791,13 +1790,13 @@ |
| 1791 | 1790 |
/// @} |
| 1792 | 1791 |
|
| 1793 | 1792 |
/// \name Primal solution |
| 1794 |
/// Functions |
|
| 1793 |
/// Functions to get the primal solution, ie. the matching. |
|
| 1795 | 1794 |
|
| 1796 | 1795 |
/// @{
|
| 1797 | 1796 |
|
| 1798 |
/// \brief Returns the |
|
| 1797 |
/// \brief Returns the weight of the matching. |
|
| 1799 | 1798 |
/// |
| 1800 |
/// Returns the |
|
| 1799 |
/// Returns the weight of the matching. |
|
| 1801 | 1800 |
Value matchingValue() const {
|
| 1802 | 1801 |
Value sum = 0; |
| 1803 | 1802 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| ... | ... |
@@ -1848,7 +1847,7 @@ |
| 1848 | 1847 |
/// @} |
| 1849 | 1848 |
|
| 1850 | 1849 |
/// \name Dual solution |
| 1851 |
/// Functions |
|
| 1850 |
/// Functions to get the dual solution. |
|
| 1852 | 1851 |
|
| 1853 | 1852 |
/// @{
|
| 1854 | 1853 |
|
| ... | ... |
@@ -1898,17 +1897,17 @@ |
| 1898 | 1897 |
return _blossom_potential[k].value; |
| 1899 | 1898 |
} |
| 1900 | 1899 |
|
| 1901 |
/// \brief |
|
| 1900 |
/// \brief Iterator for obtaining the nodes of the blossom. |
|
| 1902 | 1901 |
/// |
| 1903 |
/// Lemon iterator for get the nodes of the blossom. This class |
|
| 1904 |
/// provides a common style lemon iterator which gives back a |
|
| 1902 |
/// Iterator for obtaining the nodes of the blossom. This class |
|
| 1903 |
/// provides a common lemon style iterator for listing a |
|
| 1905 | 1904 |
/// subset of the nodes. |
| 1906 | 1905 |
class BlossomIt {
|
| 1907 | 1906 |
public: |
| 1908 | 1907 |
|
| 1909 | 1908 |
/// \brief Constructor. |
| 1910 | 1909 |
/// |
| 1911 |
/// Constructor |
|
| 1910 |
/// Constructor to get the nodes of the variable. |
|
| 1912 | 1911 |
BlossomIt(const MaxWeightedMatching& algorithm, int variable) |
| 1913 | 1912 |
: _algorithm(&algorithm) |
| 1914 | 1913 |
{
|
| ... | ... |
@@ -2817,7 +2816,7 @@ |
| 2817 | 2816 |
} |
| 2818 | 2817 |
|
| 2819 | 2818 |
/// \name Execution control |
| 2820 |
/// The simplest way to execute the algorithm is to use the |
|
| 2819 |
/// The simplest way to execute the algorithm is to use the |
|
| 2821 | 2820 |
/// \c run() member function. |
| 2822 | 2821 |
|
| 2823 | 2822 |
///@{
|
| ... | ... |
@@ -2955,7 +2954,7 @@ |
| 2955 | 2954 |
/// @} |
| 2956 | 2955 |
|
| 2957 | 2956 |
/// \name Primal solution |
| 2958 |
/// Functions |
|
| 2957 |
/// Functions to get the primal solution, ie. the matching. |
|
| 2959 | 2958 |
|
| 2960 | 2959 |
/// @{
|
| 2961 | 2960 |
|
| ... | ... |
@@ -2996,7 +2995,7 @@ |
| 2996 | 2995 |
/// @} |
| 2997 | 2996 |
|
| 2998 | 2997 |
/// \name Dual solution |
| 2999 |
/// Functions |
|
| 2998 |
/// Functions to get the dual solution. |
|
| 3000 | 2999 |
|
| 3001 | 3000 |
/// @{
|
| 3002 | 3001 |
|
| ... | ... |
@@ -3046,17 +3045,17 @@ |
| 3046 | 3045 |
return _blossom_potential[k].value; |
| 3047 | 3046 |
} |
| 3048 | 3047 |
|
| 3049 |
/// \brief |
|
| 3048 |
/// \brief Iterator for obtaining the nodes of the blossom. |
|
| 3050 | 3049 |
/// |
| 3051 |
/// Lemon iterator for get the nodes of the blossom. This class |
|
| 3052 |
/// provides a common style lemon iterator which gives back a |
|
| 3050 |
/// Iterator for obtaining the nodes of the blossom. This class |
|
| 3051 |
/// provides a common lemon style iterator for listing a |
|
| 3053 | 3052 |
/// subset of the nodes. |
| 3054 | 3053 |
class BlossomIt {
|
| 3055 | 3054 |
public: |
| 3056 | 3055 |
|
| 3057 | 3056 |
/// \brief Constructor. |
| 3058 | 3057 |
/// |
| 3059 |
/// Constructor |
|
| 3058 |
/// Constructor to get the nodes of the variable. |
|
| 3060 | 3059 |
BlossomIt(const MaxWeightedPerfectMatching& algorithm, int variable) |
| 3061 | 3060 |
: _algorithm(&algorithm) |
| 3062 | 3061 |
{
|
0 comments (0 inline)