[Lemon-user] Lemon-user Digest, Vol 104, Issue 1

Long Gong long.github at gmail.com
Wed Feb 14 20:32:04 CET 2018


 Subject: [Lemon-user] See the results of a MaximumWeightMatching
        algorithm

To the best of my knowledge, there are two APIs to do so. The first one is
mate(), the other one is matching().
For example, if you want to print the matching of a MaximumWeightMatching
object mwm, you can  use the
following for loop:

    std::cout << "Maximum Weighted Matching:\n";
    for (NodeIt n(graph);n!=INVALID;++n){
        Node v = mwm.mate(n);// get the node which is matched with node n,
if node n is not matched, you will get INVALID
        if (v != INVALID)
            std::cout << graph.id(n)
                      << " -- "
                      << graph.id(v)
                      << "\n";
    }

Or
        std::cout << "Maximum Weighted Matching:\n";
        for (NodeIt n(graph);n!=INVALID;++n){
            Edge e = mwm.matching(n);// get the matching e covers node n,
if n is node matched, you will get INVALID
            if (e != INVALID)
                std::cout << graph.id(graph.u(e))
                          << " -- "
                          << graph.id(graph.v(e))
                          << " : "
                          << weight[e]
                          << "\n";
        }
        std::cout << "Weight: " << mwm.matchingWeight() << std::endl;


On Wed, Feb 14, 2018 at 6:00 AM, <lemon-user-request at lemon.cs.elte.hu>
wrote:

> Send Lemon-user mailing list submissions to
>         lemon-user at lemon.cs.elte.hu
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
> or, via email, send a message with subject or body 'help' to
>         lemon-user-request at lemon.cs.elte.hu
>
> You can reach the person managing the list at
>         lemon-user-owner at lemon.cs.elte.hu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Lemon-user digest..."
>
>
> Today's Topics:
>
>    1. See the results of a MaximumWeightMatching algorithm
>       (RAMTIN RANJI STUDENT)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 14 Feb 2018 12:19:42 +0800
> From: RAMTIN RANJI STUDENT <ramtinranji at siswa.um.edu.my>
> To: lemon-user at lemon.cs.elte.hu
> Subject: [Lemon-user] See the results of a MaximumWeightMatching
>         algorithm
> Message-ID:
>         <CAPvCVCGxvfstnhesB9xuQP89XjCKVVqP8R0gAAriR0VfkELZkw at mail.
> gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> I will greatly appreciate if someone help me about printing the results of
> a maximumWeightMatching or MaximumWeightPerfectMatching algorithm in the
> output from a given weighted graph like matching_test.cc example.
>
> Thank You,
> Ramtin
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_
> source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_
> source=link&utm_campaign=sig-email&utm_content=webmail>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/
> attachments/20180214/d56ed19b/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>
>
> ------------------------------
>
> End of Lemon-user Digest, Vol 104, Issue 1
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20180214/0e5e10cf/attachment.html>


More information about the Lemon-user mailing list