匈牙利算法3(转载) - Something TO DO

匈牙利算法3(转载)

Something TO DO posted @ 2016年11月06日 17:01 in math , 973 阅读

这是转载的文章,如果想要系统的看,可以从匈牙利算法1http://mario.is-programmer.com/posts/52265.html开始看起!!!

 

这是一种用增广路求二分图最大匹配的算法。它由匈牙利数学家Edmonds于1965年提出,因而得名。 定义 未盖点:设Vi是图G的一个顶点,如果Vi 不与任意一条属于匹配M的边相关联,就称Vi 是一个未盖点。

交错路:设P是图G的一条路,如果P的任意两条相邻的边一定是一条属于M而另一条不属于M,就称P是一条交错路。

可增广路:两个端点都是未盖点的交错路叫做可增广路。

流程图

伪代码:

bool 寻找从k出发的对应项出的可增广路
{
    while (从邻接表中列举k能关联到顶点j)
    {
        if (j不在增广路上)
        {
            把j加入增广路;
            if (j是未盖点 或者 从j的对应项出发有可增广路)
            {
                修改j的对应项为k;
                则从k的对应项出有可增广路,返回true;
            }
        }
    }
    则从k的对应项出没有可增广路,返回false;
}

void 匈牙利hungary()
{
    for i->1 to n
    {
        if (则从i的对应项出有可增广路)
            匹配数++;
    }
    输出 匹配数;
}

演示

转载链接:https://www.byvoid.com/blog/hungary/

Avatar_small
argos uk 说:
2022年8月26日 10:16

Argos doesn't currently offer a student discount, however they offer year round sales both online and in store, argos uk and you can also find great discount vouchers online. Keep an eye on this website for the latest deals we find so you can get yourself a bargain. student discount card and app giving you access to huge offers on food and essentials, tech, travel and home delivery.Argos doesn't currently offer a student discount, however they offer year round sales both online and in store.

Avatar_small
Uttarakhand Board Mo 说:
2022年8月30日 15:38

Students Download Uttarakhand 10th Model Paper 2023 at Official Website Only, UBSE Announce its 10th Results in Month of Jun, High School Students across Uttarakhand Board are advised to Visit this Board page on Regular basis to get their Uttarakhand 10th Practical Exam Question Paper 2023. Uttarakhand Board Model Paper so if you are also among those students who have registered them self as a Regular or Private Student are Suggested to Download these Uttarakhand Board 10th Sample Paper 2023 must Prepare all Subjects. Model Papers are very helpfull Material that is Provided by the official education board.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee