{"id":7112,"date":"2024-04-14T20:01:01","date_gmt":"2024-04-14T12:01:01","guid":{"rendered":""},"modified":"2024-04-14T20:01:01","modified_gmt":"2024-04-14T12:01:01","slug":"\u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7112.html","title":{"rendered":"\u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5"},"content":{"rendered":"
\u5308\u7259\u5229\u7b97\u6cd5\u662f\u7531\u5308\u7259\u5229\u6570\u5b66\u5bb6Edmonds\u4e8e1965\u5e74\u63d0\u51fa\uff0c\u56e0\u800c\u5f97\u540d\u3002\u5308\u7259\u5229\u7b97\u6cd5\u662f\u57fa\u4e8eHall\u5b9a\u7406\u4e2d\u5145\u5206\u6027\u8bc1\u660e\u7684\u601d\u60f3\uff0c\u5b83\u662f\u90e8\u56fe\u5339\u914d\u6700\u5e38\u89c1\u7684\u7b97\u6cd5\uff0c\u8be5\u7b97\u6cd5\u7684\u6838\u5fc3\u5c31\u662f\u5bfb\u627e\u589e\u5e7f\u8def\u5f84\uff0c\u5b83\u662f\u4e00\u79cd\u7528\u589e\u5e7f\u8def\u5f84\u6c42\u4e8c\u5206\u56fe\u6700\u5927\u5339\u914d\u7684\u7b97\u6cd5\u3002<\/p>\n
\u57fa\u672c\u539f\u5219\u5c31\u662f\u5728\u539f\u6709\u5339\u914d\uff08\u6700\u5f00\u59cb\u7684\u6309\u4f18\u5148\u987a\u5e8f\u5339\u914d\uff09\u57fa\u7840\u4e0a\u91cd\u65b0\u5206\u914d\uff0c\u770b\u662f\u5426\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5339\u914d\u3002<\/span><\/strong><\/p>\n \u6211\u4eec\u9700\u8981\u4e86\u89e3\u4e00\u4e0b\u56fe\u8bba\u7684\u4e00\u4e9b\u77e5\u8bc6\u3002<\/p>\n \u8fb9\u6ca1\u6709\u65b9\u5411\u7684\u56fe\u79f0\u4e3a\u65e0\u5411\u56fe\u3002<\/p>\n \u5b9a\u4e49<\/strong><\/p>\n \u65e0\u5411\u56feG=<V,E>,\u5176\u4e2d\uff1a<\/p>\n 1.V\u662f\u975e\u7a7a\u96c6\u5408\uff0c\u79f0\u4e3a\u9876\u70b9\u96c6<\/strong>\u3002<\/span><\/p>\n 2.E\u662fV\u4e2d\u5143\u7d20\u6784\u6210\u7684\u65e0\u5e8f\u4e8c\u5143\u7ec4\u7684\u96c6\u5408\uff0c\u79f0\u4e3a\u8fb9\u96c6<\/strong>\u3002<\/span><\/p>\n \u89e3\u91ca<\/strong><\/p>\n \u76f4\u89c2\u6765\u8bf4\uff0c\u82e5\u4e00\u4e2a\u56fe\u4e2d\u6bcf\u6761\u8fb9\u90fd\u662f\u65e0\u65b9\u5411\u7684\uff0c\u5219\u79f0\u4e3a\u65e0\u5411\u56fe\u3002<\/p>\n \uff081\uff09\u65e0\u5411\u8fb9\u7684\u8868\u793a<\/p>\n \u65e0\u5411\u56fe\u4e2d\u7684\u8fb9\u5747\u662f\u9876\u70b9\u7684\u65e0\u5e8f\u5bf9\uff0c\u65e0\u5e8f\u5bf9\u901a\u5e38\u7528\u5706\u62ec\u53f7\u8868\u793a\u3002<\/p>\n \u3010\u4f8b\u3011\u65e0\u5e8f\u5bf9(vi\uff0cvj)\u548c(vj\uff0cvi)\u8868\u793a\u540c\u4e00\u6761\u8fb9\u3002<\/p>\n \uff082\uff09\u65e0\u5411\u56fe\u7684\u8868\u793a<\/p>\n \u3010\u4f8b\u3011\u4e0b\u9762(b)\u56fe\u4e2d\u7684G2\u548c(c)\u56fe\u4e2d\u7684G3\u5747\u662f\u65e0\u5411\u56fe\uff0c\u5b83\u4eec\u7684\u9876\u70b9\u96c6\u548c\u8fb9\u96c6\u5206\u522b\u4e3a\uff1a<\/p>\n V(G2)={v1\uff0cv2\uff0cv3\uff0cv4}<\/p>\n E(G2)={(vl\uff0cv2)\uff0c(v1\uff0cv3)\uff0c(v1\uff0cv4)\uff0c(v2\uff0cv3)\uff0c(v2\uff0cv4)\uff0c(v3\uff0cv4)}<\/p>\n V(G3)={v1\uff0cv2\uff0cv3\uff0cv4\uff0cv5\uff0cv6\uff0cv7}<\/p>\n E(G3)={(v1\uff0cv2)\uff0c(vl\uff0cv3)\uff0c(v2\uff0cv4)\uff0c(v2\uff0cv5)\uff0c(v3\uff0cv6)\uff0c(v3\uff0cv7)}<\/p>\n \uff083\uff09\u82e5G\u662f\u65e0\u5411\u56fe\uff0c\u52190\u2264e\u2264n(n-1)\/2<\/p>\n \u6070\u6709n(n-1)\/2\u6761\u8fb9\u7684\u65e0\u5411\u56fe\u79f0\u65e0\u5411\u5b8c\u5168\u56fe(Undirected Complete Graph)<\/p>\n \u6ce8\u610f\uff1a\u5b8c\u5168\u56fe\u5177\u6709\u6700\u591a\u7684\u8fb9\u6570\u3002\u4efb\u610f\u4e00\u5bf9\u9876\u70b9\u95f4\u5747\u6709\u8fb9\u76f8\u8fde\u3002<\/p>\n <\/p>\n \u56fe1<\/p>\n \u4e0e\u4e4b\u5bf9\u5e94\u7684\u5219\u88ab\u79f0\u4e3a\u201c\u6709\u5411\u56fe<\/strong><\/span>\u201d\u3002\u4e24\u8005\u552f\u4e00\u7684\u533a\u522b\u5728\u4e8e\uff0c\u6709\u5411\u56fe\u4e2d\u7684\u8fb9\u662f\u6709\u65b9\u5411\u6027\u7684\u3002\u4e0b\u56fe\u5373\u662f\u4e00\u4e2a\u6709\u5411\u56fe\uff0c\u8fb9\u7684\u65b9\u5411\u5206\u522b\u662f\uff1a(1->2), (1-> 3), (3-> 1), (1->5), (2->3), (3->4), (3->5), (4->5), (1->6), (4->6)\u3002\u8981\u6ce8\u610f\uff0c\u56fe\u4e2d\u7684\u8fb9(1->3)\u548c(3->1)\u662f\u4e0d\u540c\u7684\u3002\u6709\u5411\u56fe\u548c\u65e0\u5411\u56fe\u7684\u8bb8\u591a\u539f\u7406\u548c\u7b97\u6cd5\u662f\u76f8\u901a\u7684\u3002 <\/p>\n <\/p>\n \u56fe2<\/p>\n \u4e8c\u5206\u56fe\u53c8\u79f0\u4f5c\u4e8c\u90e8\u56fe\uff0c\u662f\u56fe\u8bba\u4e2d\u7684\u4e00\u79cd\u7279\u6b8a\u6a21\u578b\u3002 \u8bbeG=(V,E)\u662f\u4e00\u4e2a\u65e0\u5411\u56fe\uff0c\u5982\u679c\u9876\u70b9V\u53ef\u5206\u5272\u4e3a\u4e24\u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u5b50\u96c6(A,B)\uff0c\u5e76\u4e14\u56fe\u4e2d\u7684\u6bcf\u6761\u8fb9\uff08i\uff0cj\uff09\u6240\u5173\u8054\u7684\u4e24\u4e2a\u9876\u70b9i\u548cj\u5206\u522b\u5c5e\u4e8e\u8fd9\u4e24\u4e2a\u4e0d\u540c\u7684\u9876\u70b9\u96c6(i in A,j in B)\uff0c\u5219\u79f0\u56feG\u4e3a\u4e00\u4e2a\u4e8c\u5206\u56fe\u3002<\/p>\n <\/p>\n \u56fe3<\/p>\n \u7b80\u800c\u8a00\u4e4b\uff0c\u5c31\u662f\u9876\u70b9\u96c6V\u53ef\u5206\u5272\u4e3a\u4e24\u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u5b50\u96c6\uff0c\u5e76\u4e14\u56fe\u4e2d\u6bcf\u6761\u8fb9\u4f9d\u9644\u7684\u4e24\u4e2a\u9876\u70b9\u90fd\u5206\u5c5e\u4e8e\u8fd9\u4e24\u4e2a\u4e92\u4e0d\u76f8\u4ea4\u7684\u5b50\u96c6\uff0c\u4e24\u4e2a\u5b50\u96c6\u5185\u7684\u9876\u70b9\u4e0d\u76f8\u90bb\u3002<\/p>\n \u4e8c\u5206\u56fe\u7684\u6027\u8d28\u53ca\u5224\u5b9a<\/strong><\/p>\n \u65e0\u5411\u56feG\u4e3a\u4e8c\u5206\u56fe\u7684\u5145\u5206\u5fc5\u8981\u6761\u4ef6\u662f\uff0cG\u81f3\u5c11\u6709\u4e24\u4e2a\u9876\u70b9\uff0c\u4e14\u5176\u6240\u6709\u56de\u8def\u7684\u957f\u5ea6\u5747\u4e3a\u5076\u6570\u3002\u5982\u679c\u65e0\u56de\u8def\uff08\u5982\u56fe3\u5c31\u6ca1\u6709\u56de\u8def\uff09\uff0c\u76f8\u5f53\u4e8e\u4efb\u4e00\u56de\u8def\u7684\u6b21\u6570\u4e3a0\uff0c0\u4e5f\u662f\u5076\u6570\uff0c\u6545\u4e5f\u89c6\u4e3a\u4e8c\u5206\u56fe\u3002<\/p>\n <\/p>\n \u56fe4<\/p>\n \u89c1\u56fe4\u6240\u793a\uff0c\u5176\u5b58\u5728\u56de\u8def\u3002\u5982\uff1a1-4-2-5-1\uff0c\u957f\u5ea6\u4e3a4\uff0c\u5076\u6570\u3002\u4efb\u610f\u4e00\u79cd\u90fd\u4e3a\u5076\u6570\uff08\u5faa\u73af\u7684\u5468\u671f\u56de\u8def\u4e5f\u662f\u5076\u6570\uff09\u3002\u5982\u679c\u57281\u548c2\u4e4b\u524d\u6dfb\u4e00\u6761\u8fb9\uff0c\u90a3\u5c31\u4e0d\u662f\u4e8c\u5206\u56fe\u4e86\uff0c\u5982\u4e0b\u56fe\u3002 <\/p>\n <\/p>\n \u56fe5<\/p>\n \u6dfb\u4e861--2\u7684\u8fb9\u540e\uff0c\u56de\u8def\u5c31\u5b58\u5728\u4e861--4--2--1\uff0c\u957f\u5ea6\u4e3a3\uff0c\u5947\u6570\uff0c\u6240\u4ee5\u56fe3\u5c31\u4e0d\u662f\u4e8c\u5206\u56fe\u3002\u8fd9\u4e5f\u8fdd\u80cc\u4e86\u4e8c\u5206\u56fe\u7684\u5b9a\u4e49 \uff0c\u5b9a\u4e49\u4e2d\u6307\u51fa\u56fe\u4e2d\u7684\u6bcf\u6761\u8fb9\uff08i\uff0cj\uff09\u6240\u5173\u8054\u7684\u4e24\u4e2a\u9876\u70b9i\u548cj\u5206\u522b\u5c5e\u4e8e\u8fd9\u4e24\u4e2a\u4e0d\u540c\u7684\u9876\u70b9\u96c6(i in A,j in B)\uff0c\u4f46\u662f\u5f88\u660e\u663e\u56fe5\u4e2d1-2\u7684\u8fb9\u7684\u4e24\u4e2a\u9876\u70b9\u6765\u81ea\u540c\u4e00\u4e2a\u70b9\u96c6\u3002<\/p>\n \u7ed9\u5b9a\u4e00\u4e2a\u4e8c\u5206\u56feG\uff0c\u5728G\u7684\u4e00\u4e2a\u5b50\u56feM\u4e2d\uff0cM\u7684\u8fb9\u96c6{E}\u4e2d\u7684\u4efb\u610f\u4e24\u6761\u8fb9\u90fd\u4e0d\u4f9d\u9644\u4e8e\u540c\u4e00\u4e2a\u9876\u70b9\uff0c\u5219\u79f0M\u662f\u4e00\u4e2a\u5339\u914d\u3002 <\/p>\n \u56fe6<\/p>\n \u6700\u5927\u5339\u914d<\/strong><\/p>\n \u9009\u62e9\u8fb9\u6570\u6700\u5927\u7684\u5b50\u56fe\u79f0\u4e3a\u56fe\u7684\u6700\u5927\u5339\u914d\u95ee\u9898(maximal matching problem)<\/strong> <\/p>\n \u56fe7 \u56fe8<\/p>\n \u4e5f\u79f0\u589e\u5e7f\u8f68\u6216\u4ea4\u9519\u8f68\u3002\u8bbeM\u4e3a\u4e8c\u5206\u56feG\u5df2\u5339\u914d\u8fb9\u7684\u96c6\u5408\uff0c\u82e5P\u662f\u56feG\u4e2d\u4e00\u6761\u8054\u901a\u4e24\u4e2a\u672a\u5339\u914d\u9876\u70b9\u7684\u8def\u5f84<\/strong>\uff0c\u4e14\u5c5e\u4e8eM\u7684\u8fb9\u548c\u4e0d\u5c5e\u4e8eM\u7684\u8fb9\u5728P\u4e0a\u4ea4\u66ff\u51fa\u73b0\uff0c\u5219\u79f0P\u4e3a\u76f8\u5bf9\u4e8eM\u7684\u4e00\u6761\u589e\u5e7f\u8def\u5f84\u3002<\/strong>P\u7684\u8d77\u70b9\u5728X\u90e8\uff0c\u7ec8\u70b9\u5728Y\u90e8\uff0c\u53cd\u4e4b\u4ea6\u53ef\uff0c\u8def\u5f84P\u7684\u8d77\u70b9\u7ec8\u70b9\u90fd\u662f\u672a\u5339\u914d\u7684\u70b9\u3002<\/p>\n \u589e\u5e7f\u8def\u5f84\u662f\u4e00\u6761\u201c\u4ea4\u9519\u8f68\u201d\u3002\u4e5f\u5c31\u662f\u8bf4, \u5b83\u7684\u7b2c\u4e00\u6761\u8fb9\u662f\u76ee\u524d\u8fd8\u6ca1\u6709\u53c2\u4e0e\u5339\u914d\u7684,\u7b2c\u4e8c\u6761\u8fb9\u53c2\u4e0e\u4e86\u5339\u914d,\u7b2c\u4e09\u6761\u8fb9\u6ca1\u6709..\u6700\u540e\u4e00\u6761\u8fb9\u6ca1\u6709\u53c2\u4e0e\u5339\u914d,\u5e76\u4e14\u8d77\u70b9\u548c\u7ec8\u70b9\u8fd8\u6ca1\u6709\u88ab\u9009\u62e9\u8fc7\uff0c\u8fd9\u6837\u4ea4\u9519\u8fdb\u884c,\u663e\u7136P\u6709\u5947\u6570\u6761\u8fb9\uff0c\u56e0\u4e3a\u4e0d\u5c5e\u4e8e\u5339\u914d\u7684\u8fb9\u6bd4\u5339\u914d\u7684\u8fb9\u8981\u591a\u4e00\u6761<\/strong>\uff01\u3002<\/p>\n <\/p>\n \u56fe9<\/p>\n \u5982\u56fe9\uff0c\u7ea2\u8fb9\u4e3a\u4e09\u6761\u5df2\u7ecf\u5339\u914d\u7684\u8fb9\u3002\u4eceX\u90e8\u4e00\u4e2a\u672a\u5339\u914d\u7684\u9876\u70b9x4\u5f00\u59cb\uff0c\u627e\u4e00\u6761\u8def\u5f84P\uff1a \u5176\u4e2d\u6709\u5c5e\u4e8e\u5339\u914dM\u7684\u8fb9\u4e3a{x2,y3},{x1,y1} \uff0c\u4e0d\u5c5e\u4e8e\u5339\u914d\u7684\u8fb9\u4e3a{x4,y3},{x2, y1}, {x1,y2} <\/p>\n \u56fe10<\/p>\n \u5982\u679c\u4eceM\u4e2d\u62bd\u8d70{x2,y3},{x1,y1}\uff0c\u5e76\u52a0\u5165{x4,y3},{x2, y1}, {x1,y2}\uff0c\u4e5f\u5c31\u662f\u5c06\u589e\u5e7f\u8def\u6240\u6709\u7684\u8fb9\u8fdb\u884c\u201d\u53cd\u8272\u201d,\u5219\u53ef\u4ee5\u5f97\u5230\u56db\u6761\u8fb9\u7684\u5339\u914dM\u2019={ \u53e6\u5916,\u5355\u72ec\u7684\u4e00\u6761\u8fde\u63a5\u4e24\u4e2a\u672a\u5339\u914d\u70b9\u7684\u8fb9\u663e\u7136\u4e5f\u662f\u4ea4\u9519\u8f68\u3002<\/strong><\/span>\u53ef\u4ee5\u8bc1\u660e,\u5f53\u4e0d\u80fd\u518d\u627e\u5230\u589e\u5e7f\u8f68\u65f6,\u5c31\u5f97\u5230\u4e86\u4e00\u4e2a\u6700\u5927\u5339\u914d.\u8fd9\u4e5f\u5c31\u662f\u5308\u7259\u5229\u7b97\u6cd5\u7684\u601d\u8def. <\/p>\n \u4e0b\u9762\u4ecb\u7ecd\u5355\u72ec\u7684\u4e00\u6761\u8fde\u63a5\u4e24\u4e2a\u672a\u5339\u914d\u70b9\u7684\u8fb9\u663e\u7136\u4e5f\u662f\u4ea4\u9519\u8f68\u7684\u60c5\u51b5\u3002\u5982\u5728\u56fe11\u4e2d\uff0c\u521a\u5f00\u59cb\u7684\u65f6\u5019\uff0c\u6ca1\u6709\u4e00\u4e2a\u5339\u914d\u7684\uff0c\u6b64\u65f6\u8fdb\u884c\u5339\u914d1-1,1\u548c1\u76f8\u8fde\u5c31\u662f\u4e00\u6761\u589e\u5e7f\u8def\u5f84\uff08\u4ea4\u9519\u8f68\uff09<\/strong>\u3002<\/p>\n <\/p>\n \u56fe11<\/p>\n \u7531\u589e\u5e7f\u8def\u7684\u5b9a\u4e49\u53ef\u4ee5\u63a8\u51fa\u4e0b\u8ff0\u4e09\u4e2a\u7ed3\u8bba\uff1a<\/p>\n \u4e0b\u9762\u8bf7\u51fa\u4e3b\u89d2\u4e0a\u573a<\/p>\n \u7528\u589e\u5e7f\u8def\u6c42\u6700\u5927\u5339\u914d(\u79f0\u4f5c\u5308\u7259\u5229\u7b97\u6cd5\uff0c\u5308\u7259\u5229\u6570\u5b66\u5bb6Edmonds\u4e8e1965\u5e74\u63d0\u51fa) \u6211\u4eec\u91c7\u7528DFS\uff08\u6df1\u5ea6\u4f18\u5148\u641c\u7d22\uff09\u7684\u529e\u6cd5\u627e\u4e00\u6761\u589e\u5e7f\u8def\u5f84\uff1a <\/p>\n \u4eceX\u90e8\u4e00\u4e2a\u672a\u5339\u914d\u7684\u9876\u70b9Xi\u5f00\u59cb\uff0c\u627e\u4e00\u4e2a\u672a\u8bbf\u95ee\u7684\u90bb\u63a5\u70b9Yi\uff08Yi\u4e00\u5b9a\u662fY\u90e8\u9876\u70b9\uff09\u3002\u5bf9\u4e8eYi\uff0c\u5206\u4e24\u79cd\u60c5\u51b5\uff1a<\/p>\n \u5982\u679cYi\u672a\u5339\u914d\uff0c\u8fd9\u4fe9\u76f8\u8fde\uff0c\u5219\u5c31\u7b97\u5df2\u7ecf\u627e\u5230\u4e00\u6761\u589e\u5e7f\u8def\uff08\u662f\u5355\u4e2a\u8fb9\u7684\u589e\u5e7f\u8def\u5f84\uff09 \u7136\u540e\u53d6\u53cd\uff0c\u5219(Xi,Yi)\u5c31\u5339\u914d\u4e0a\u4e86\uff0c\u603b\u7684\u5339\u914d\u7684\u8fb9\u8981\u591a\u4e00\u6761\u4e86\u3002<\/p>\n X Y<\/p>\n <\/p>\n \u56fe12<\/p>\n \u8bf7\u5148\u770b\u56fe11\uff0c\u56fe11\u4e2d\u7ea2\u7ebf\u8868\u793a\u7684\u662f\u672a\u5339\u914d\u7684\u8fb9\uff08\u8fd9\u5c31\u662f\u7f6eM\u4e3a\u7a7a<\/strong>\uff09\uff0c\u518d\u770b\u5982\u56fe12\u6240\u793a\uff0c\u84dd\u7ebf\u8868\u793a\u7684\u662f\u5df2\u5339\u914d\u7684\u8fb9\uff0c\u8fd9\u4e24\u4e2a\u5339\u914d\u7684\u90fd\u662f\u5355\u4e2a\u8fb9\u7684\u589e\u5e7f\u8def\u5f84\uff08\u5728Y\u90e8\u5206\u4ece\u4e0a\u5f80\u4e0b\u627e\uff09\u3002\u56e0\u6b64X1\uff0cX2\uff0c\u90fd\u627e\u5230\u4e86\u5355\u8fb9\u7684\u589e\u5e7f\u8def\u5f84\u3002\u63a5\u7740\u8be5X3\u4e86\uff0cX3\u5148\u4eceY1\u4e0b\u624b\uff0cY1\u5df2\u7ecf\u548cX1\u5339\u914d\u4e86\uff0c\u8fd9\u65f6\u770bX1\uff08\u8fd9\u65f6\u628aX1\u770b\u4e3a\u672a\u5339\u914d\u7684\u70b9\uff0c\u56e0\u4e3a\u589e\u5e7f\u8def\u5f84\u7684\u5b9a\u4e49\u662f\uff0c\u4ece\u8d77\u70b9\u4e3a\u672a\u5339\u914d\u7684\u70b9\u5230\u7ec8\u70b9\u4e3a\u672a\u5339\u914d\u7684\u70b9\uff09\u80fd\u4e0d\u80fd\u627e\u5230\u4e00\u6761\u589e\u5e7f\u8def\u5f84\uff0c\u663e\u7136\u4eceX1\u51fa\u53d1\u53ef\u4ee5\u627e\u5230\u4e00\u6761\u589e\u5e7f\u8def\u5f84\uff1aX1Y2-Y2X2-X2Y3\u3002\u8fd9\u65f6\u5c31\u5f62\u6210\u4e86\u65b0\u7684\u589e\u5e7f\u8def\u5f84\uff1aX3Y1-Y1X1-X1Y2-Y2X2-X2Y3\u3002\u6b64\u65f6\u6839\u636e\u53d6\u53cd\u64cd\u4f5c\uff0c\u5219X3Y1\u3001X1Y2\u3001X2Y3\uff0c\u6210\u4e3a\u5339\u914d\u8fb9\uff083\u6761\uff09\u3002\u6bd4\u4e4b\u524d\u7684\u4e24\u6761\u5339\u914d\u8fb9\u591a\u4e86\u4e00\u6761\u3002<\/p>\n \u5339\u914d\u7ed3\u679c\u5982\u56fe13\u6240\u793a\uff0c\u9ec4\u8272\u662f\u4e4b\u524d\u7684\u5339\u914d\uff0c\u84dd\u8272\u662f\u65b0\u7684\u5339\u914d\u3002<\/p>\n <\/p>\n \u56fe13<\/p>\n \u63a5\u4e0b\u6765\u662fX4\uff0cX4\u56e0\u4e3a\u627e\u4e0d\u589e\u5e7f\u8def\u5f84\uff08\u589e\u5e7f\u8def\u5f84\u4ece\u672a\u5339\u914d\u8d77\u70b9\u51fa\u53d1\uff0c\u5230\u672a\u5339\u914d\u70b9\u7684\u7ec8\u70b9\uff09\uff0c\u6240\u4ee5\u65e0\u6cd5\u8fdb\u884c\u5339\u914d\u3002\u6545\u6700\u5927\u5339\u914d\u7ed3\u679c\u4e3a\uff1a<\/p>\n <\/p>\n \u56fe14<\/p>\n \u4e0b\u9762\u7684\u4ee3\u7801\u6c42\u7684\u662f\u6700\u5927\u5339\u914d\u6570\u91cf\u3002<\/p>\n \u5308\u7259\u5229\u7b97\u6cd5\u4e2d\u7684\u589e\u5e7f\u8def\u5f84\u53d6\u53cd\u64cd\u4f5c\u5728\u4ee3\u7801\u5b9e\u73b0\u7684\u65f6\u5019\u4f7f\u7528\u7684\u662f\u9012\u5f52\uff0c\u9012\u5f52\u4e00\u76f4\u5f80\u4e0b\u627e\u3002\u5728\u9012\u5f52\u8fc7\u7a0b\u4e2d\uff0c\u8fdb\u884c\u53d6\u53cd\u64cd\u4f5c\u3002<\/p>\n \u7b2c29\u884c\u4ee3\u7801\uff1aresult[i] = x; \u5b9e\u9645\u4e0a\u5c31\u662f\u53d6\u53cd\u64cd\u4f5c\u3002<\/p>\n \u6211\u4eec\u4ee5\u56fe11\u4e3a\u4f8b\uff0c\u8fdb\u884c\u4ee3\u7801\u6d4b\u8bd5\u3002\u6d4b\u8bd5\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n <\/p>\n \u53c2\u8003\u535a\u5ba2<\/strong>\uff1a<\/p>\n \u8da3\u5199\u7b97\u6cd5\u7cfb\u5217\u4e4b--\u5308\u7259\u5229\u7b97\u6cd5\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5\u548cKM\u7b97\u6cd5\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u5308\u7259\u5229\u7b97\u6cd5\u2014\u2014\u6700\u5927\u5339\u914d\u95ee\u9898\u8be6\u89e3\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u7b97\u6cd5\u8bb2\u89e3\uff1a\u4e8c\u5206\u56fe\u5339\u914d\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u5308\u7259\u5229\u7b97\u6cd5\u4e0e\u589e\u5e7f\u8def\u5f84\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u4e8c\u5206\u56fe\u7684\u5b9a\u4e49\u548c\u5224\u5b9a\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n \u56fe\u8bba\uff08\u4e00\uff09\u56fe\uff1a\u9876\u70b9\uff0c\u8fb9\uff0c\u540c\u6784\uff0c\u6709\u5411\/\u65e0\u5411\u56fe\uff0c\u6743\u91cd\uff0c\u8def\u5f84\uff08\u6700\u77ed\u8def\u5f84\uff09\uff0c\u73af\uff0c\u8fde\u901a\u56fe\/\u8fde\u901a\u5206\u91cf\uff1a<\/p>\n \u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n <\/p>\n [AI\u5f00\u53d1]\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684\u89c6\u9891\u591a\u76ee\u6807\u8ddf\u8e2a\u5b9e\u73b0\uff1a<\/p>\n https:\/\/www.cnblogs.com\/xiaozhi_5638\/p\/9376784.html<\/p>\n <\/p>\n \u4eba\u6570\u4e0e\u5de5\u4f5c\u6570\u4e0d\u7b49\u7684\u6307\u6d3e\u95ee\u9898<\/p>\n \u5de5\u4f5c\uff1c\u4eba\u6570\uff0c\u589e\u52a0\u865a\u62df\u5de5\u4f5c<\/strong>\uff1b\u4eba\u6570\uff1c\u5de5\u4f5c\uff0c\u589e\u52a0\u865a\u62df\u5de5\u4eba<\/strong>\u3002\u53c2\u8003\uff1a\u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n <\/p>\n \u6307\u6d3e\u95ee\u9898\uff08\u5308\u7259\u5229\u7b97\u6cd5\uff09<\/strong><\/span>\uff1ahttps:\/\/www.cnblogs.com\/ylHe\/p\/9287384.html<\/p>\n \u57fa\u4e8e\u5308\u7259\u5229\u7b97\u6cd5\u7684\u4efb\u52a1\u5206\u914d\u95ee\u9898\u7684python\u5b9e\u73b0\uff1a\u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5<\/p>\n Hungarian algorithm\uff1ahttp:\/\/www.hungarianalgorithm.com\/examplehungarianalgorithm.php<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e8c\u5206\u56fe\u5339\u914d\u2014\u2014\u5308\u7259\u5229\u7b97\u6cd5\u5308\u7259\u5229\u7b97\u6cd5\u662f\u7531\u5308\u7259\u5229\u6570\u5b66\u5bb6Edmonds\u4e8e1965\u5e74\u63d0\u51fa\uff0c\u56e0\u800c\u5f97\u540d","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7112"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7112"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7112\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u9884\u5907\u77e5\u8bc6<\/h2>\n
1 \u65e0\u5411\u56fe<\/h4>\n
2 \u4e8c\u5206\u56fe<\/h4>\n
3 \u4e8c\u5206\u56fe\u5339\u914d<\/h4>\n
\u56fe\u4e2d\u52a0\u7c97\u7684\u8fb9\u662f\u6570\u91cf\u4e3a2\u7684\u5339\u914d\u3002 <\/p>\n
\u5982\u679c\u4e00\u4e2a\u5339\u914d\u4e2d\uff0c\u56fe\u4e2d\u7684\u6bcf\u4e2a\u9876\u70b9<\/strong>\u90fd\u548c\u56fe\u4e2d\u67d0\u6761\u8fb9\u76f8\u5173\u8054\uff0c\u5219\u79f0\u6b64\u5339\u914d\u4e3a\u5b8c\u5168\u5339\u914d<\/strong>\uff0c\u4e5f\u79f0\u4f5c\u5b8c\u5907\u5339\u914d<\/strong>\u3002
\u56fe7\u6240\u793a\u4e3a\u4e00\u4e2a\u6700\u5927\u5339\u914d\uff0c\u4f46\u4e0d\u662f\u5b8c\u5168\u5339\u914d\u3002\u56fe8\u662f\u4e2a\u5b8c\u5168\u5339\u914d\u3002<\/p>\n\u589e\u5e7f\u8def\u5f84<\/h4>\n
x4y3-y3x2-x2y1-y1x1-x1y2
\u56e0\u4e3ay2\u662fY\u90e8\u4e2d\u672a\u5339\u914d\u7684\u9876\u70b9\uff0cx4\u662fX\u90e8\u4e2d\u672a\u5339\u914d\u7684\u9876\u70b9\uff0c\u4e14\u5339\u914d\u7684\u8fb9\u548c\u672a\u5339\u914d\u7684\u8fb9\u4ea4\u66ff\u51fa\u73b0<\/strong>\uff0c\u6545\u6240\u627e\u8def\u5f84\u662f\u589e\u5e7f\u8def\u5f84P\u3002 <\/p>\n
\u53ef\u4ee5\u770b\u51fa\uff1aP\u6709\u5947\u6570\u6761\u8fb9\uff0c\u4e0d\u5c5e\u4e8e\u5339\u914d\u7684\u8fb9\u8981\u591a\u4e00\u6761<\/strong>\uff01<\/p>\n
\n {x3,y4}, {x4,y3},{x2, y1}, {x1,y2}} \u3002\u5982\u56fe10\u6240\u793a\uff0c\u53ef\u77e5\u56db\u6761\u8fb9\u7684\u5339\u914d\u662f\u6700\u5927\u5339\u914d\uff0c\u4e5f\u662f\u5b8c\u5168\u5339\u914d\u3002
\u5bb9\u6613\u53d1\u73b0\u8fd9\u6837\u4fee\u6539\u4ee5\u540e,\u5339\u914d\u4ecd\u7136\u662f\u5408\u6cd5\u7684,\u4f46\u662f\u5339\u914d\u6570\u589e\u52a0\u4e86\u4e00\u5bf9<\/strong>\u3002<\/p>\n\u589e\u5e7f\u8def\u5f84\u6027\u8d28<\/h4>\n
\n
\u5308\u7259\u5229\u7b97\u6cd5<\/h4>\n
\u7b97\u6cd5\u8f6e\u5ed3\uff1a<\/p>\n\n
\u627e\u589e\u5e7f\u8def\u5f84\u7684\u7b97\u6cd5<\/h4>\n
\u5982\u679cYi\u5df2\u7ecf\u5339\u914d\uff0c\u5219\u53d6\u51fayi\u7684\u5339\u914d\u9876\u70b9Xm(Xm\u4e00\u5b9a\u662fX\u90e8\u9876\u70b9)\uff0c\u8fb9(Xm,Yi)\u76ee\u524d\u662f\u5339\u914d\u7684\uff0c\u6839\u636e\u201c\u53d6\u53cd\u201d\u7684\u60f3\u6cd5\uff0c\u8981\u5c06(Xm,Yi)\u6539\u4e3a\u672a\u5339\u914d\uff0c(Xi,Yi)\u8bbe\u4e3a\u5339\u914d\uff0c\u80fd\u5b9e\u73b0\u8fd9\u4e00\u70b9\u7684\u6761\u4ef6\u662f\u770b\u4eceXm\u4e3a\u8d77\u70b9\u80fd\u5426\u65b0\u627e\u5230\u4e00\u6761\u589e\u5e7f\u8def\u5f84P\u2019\u3002\u5982\u679c\u884c\uff0c\u5219Xi-Yi-P\u2019\u5c31\u662f\u4e00\u6761\u4ee5Xi\u4e3a\u8d77\u70b9\u7684\u589e\u5e7f\u8def\u5f84\u3002<\/p>\n\u4ee3\u7801\u5b9e\u73b0<\/h4>\n
\/**\n *Copyright (c) 2019 Young Fan.All Right Reserved.\n *Author: Young Fan\n *Date: 2019.05.31\n *IDE: Visual Studio 2017\n *Description:\n *\/\n\n#define _CRT_SECURE_NO_WARNINGS\n#include<iostream>\n#include<stdio.h>\n\nusing namespace std;\n\nconst int N = 505; \/\/\u8bbe\u7f6e\u6570\u7ec4\u7684\u5927\u5c0f\nbool line[N][N]; \/\/\u8bb0\u5f55\u8fde\u63a5x\u548cy\u7684\u8fb9\uff0c\u5982\u679ci\u548cj\u4e4b\u95f4\u6709\u8fb9\u5219\u4e3a1\uff0c\u5426\u5219\u4e3a0\nint result[N]; \/\/\u8bb0\u5f55\u5f53\u524d\u4e0ey\u8282\u70b9\u76f8\u8fde\u7684x\u7684\u8282\u70b9\uff1ai\u672a\u52a0\u5165\u5339\u914d\u65f6\u4e3alink[i]==0\nbool used[N]; \/\/\u8bb0\u5f55y\u4e2d\u8282\u70b9\u662f\u5426\u4f7f\u7528\nint k, m, n;\nbool found(int x)\n{\n\tfor (int i = 1; i <= n; i++)\n\t{\n\t\tif (line[x][i] && !used[i])\n\t\t{\n\t\t\tused[i] = true;\n\t\t\tif (result[i] == 0 || found(result[i]))\n\t\t\t{\n\t\t\t\tresult[i] = x;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\nint main()\n{\n\tint x, y;\n\tprintf(\"\u8bf7\u8f93\u5165\u76f8\u8fde\u8fb9\u7684\u6570\u91cfk\uff1a\\n\");\n\twhile (scanf(\"%d\", &k) && k) \/\/\u5f53\u8f93\u5165\u7684k\u503c\u5927\u4e8e0\u624d\u53ef\u4ee5\u5f80\u4e0b\u6267\u884c\u3002\u4e14\u53ef\u4ee5\u5faa\u73af\u8f93\u5165k\uff1b\u8f93\u5165\u65f6\uff0c\u7528\u7a7a\u683c\u4f5c\u4e3a\u5206\u9694\u7b26\n\t{\n\t\tprintf(\"\u8bf7\u8f93\u5165\u4e8c\u5206\u56fe\u4e2dx\u548cy\u4e2d\u70b9\u7684\u6570\u76ee\uff1a\\n\");\n\t\tscanf(\"%d %d\", &m, &n); \n\t\tmemset(line, 0, sizeof(line));\n\t\tmemset(result, 0, sizeof(result));\n\t\tfor (int i = 0; i < k; i++)\n\t\t{\n\t\t\tprintf(\"\u8bf7\u8f93\u5165\u76f8\u8fde\u8fb9\u7684\u4e24\u4e2a\u70b9\uff1a\\n\");\n\t\t\tscanf(\"%d %d\", &x, &y);\n\t\t\tline[x][y] = 1;\n\t\t}\n\t\tint sum = 0;\n\t\tfor (int i = 1; i <= m; i++)\n\t\t{\n\t\t\tmemset(used, 0, sizeof(used)); \/\/\u7f6e\u7a7a\u64cd\u4f5c\n\t\t\tif (found(i)) sum++;\n\t\t}\n\t\tprintf(\"%d\\n\", sum);\n\t}\n\treturn 0;\n}<\/code><\/pre>\n
\u5e94\u7528\uff1a<\/strong><\/h4>\n
\u5308\u7259\u5229\u7b97\u6cd5-\u6307\u6d3e\u95ee\u9898<\/h4>\n