{"id":78023,"date":"2026-02-25T22:09:44","date_gmt":"2026-02-25T14:09:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/78023.html"},"modified":"2026-02-25T22:09:44","modified_gmt":"2026-02-25T14:09:44","slug":"%e5%9b%be%e7%9a%84%e9%81%8d%e5%8e%86%ef%bc%88dfsbfs%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/78023.html","title":{"rendered":"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09"},"content":{"rendered":"<p>\u66f4\u52a0\u5b8c\u6574\u8be6\u7ec6\u5185\u5bb9\u53ef\u67e5\u770b\u3010\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0\u3011\u548c\u3010\u514d\u8d39\u7248Java\u9762\u8bd5\u9898\u3011<\/p>\n<p>\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8<br \/>\n\u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;20w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto<br \/>\n\u5b8c\u6574\u7248Java\u5b66\u4e60\u7b14\u8bb0200w\u5b57&#xff0c;\u9644\u6709\u4ee3\u7801\u5b9e\u73b0&#xff0c;\u56fe\u89e3\u6e05\u695a&#xff0c;\u4ec5\u97009.9<br \/>\n\u5b8c\u6574\u7248Java\u9762\u8bd5\u9898&#xff0c;150w\u5b57&#xff0c;\u9ad8\u9891\u9762\u8bd5\u9898&#xff0c;\u5185\u5bb9\u8be6\u7ec6&#xff0c;\u4ec5\u97009.9<br \/>\n\u5b8c\u6574\u7248\u94fe\u63a5&#xff1a;<br \/>\nhttps:\/\/www.xiaohongshu.com\/user\/profile\/63c2d512000000002601232c<br \/>\n\u795d\u60a8\u65b0\u7684\u4e00\u5e74\u4e8b\u4e8b\u9a6c\u5230\u6210\u529f&#xff0c;\u8eab\u4f53\u5065\u5eb7&#xff0c;\u9616\u5bb6\u5e78\u798f&#xff0c;\u5927\u5c55\u5b8f\u56fe&#xff01;<\/p>\n<\/p>\n<p id=\"ubac793d1\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1020\" id=\"ude433135\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140937-699f02a15c13f.png\" width=\"1920\" \/><\/p>\n<h3 id=\"MDJ96\">\u4e00\u3001\u56fe\u7684\u904d\u5386\u4ecb\u7ecd<\/h3>\n<h4 id=\"VbcJS\">1.1 \u904d\u5386\u7684\u5b9a\u4e49\u4e0e\u8981\u6c42<\/h4>\n<p id=\"u1f6c10d9\">\u56fe\u7684\u904d\u5386\u662f\u6307\u4ece\u56fe\u4e2d\u4efb\u610f\u6307\u5b9a\u9876\u70b9&#xff08;\u521d\u59cb\u70b9&#xff09;\u51fa\u53d1&#xff0c;\u6309\u7167\u7279\u5b9a\u641c\u7d22\u7b56\u7565\u6cbf\u7740\u8fb9\u8bbf\u95ee\u6240\u6709\u9876\u70b9\u4e14\u6bcf\u4e2a\u9876\u70b9\u4ec5\u8bbf\u95ee\u4e00\u6b21\u7684\u8fc7\u7a0b&#xff0c;\u904d\u5386\u5f97\u5230\u7684\u9876\u70b9\u5e8f\u5217\u79f0\u4e3a\u904d\u5386\u5e8f\u5217\u3002<br \/>\n\u8981\u6c42&#xff1a;\u5168\u8bbf\u95ee\u3001\u4e0d\u91cd\u590d\u2014\u2014\u8fd9\u662f\u56e0\u4e3a\u56fe\u5b58\u5728\u73af\u548c\u591a\u5bf9\u591a\u8fde\u63a5&#xff0c;\u76f8\u6bd4\u4e8c\u53c9\u6811&#xff08;\u65e0\u73af\u3001\u4e00\u5bf9\u591a&#xff09;&#xff0c;\u904d\u5386\u9700\u589e\u52a0\u8bbf\u95ee\u6807\u8bb0\u907f\u514d\u91cd\u590d\u8bbf\u95ee&#xff0c;\u662f\u56fe\u904d\u5386\u7684\u5173\u952e\u8981\u70b9\u3002<\/p>\n<h4 id=\"Wvkhq\">1.2 \u4e24\u79cd\u641c\u7d22\u7b56\u7565<\/h4>\n<p id=\"u0ab92dc1\">\u6839\u636e\u8bbf\u95ee\u9876\u70b9\u7684\u987a\u5e8f\u4e0d\u540c&#xff0c;\u56fe\u7684\u904d\u5386\u5206\u4e3a\u6df1\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;DFS&#xff09;\u548c\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;BFS&#xff09;&#xff0c;\u4e8c\u8005\u662f\u56fe\u8bba\u4e2d\u6700\u57fa\u7840\u3001\u5e94\u7528\u6700\u5e7f\u6cdb\u7684\u7b97\u6cd5&#xff0c;\u5206\u522b\u57fa\u4e8e\u6808\u548c\u961f\u5217\u5b9e\u73b0&#xff0c;\u9002\u914d\u4e0d\u540c\u7684\u4e1a\u52a1\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li id=\"u541419fb\">DFS&#xff1a;\u6df1\u5ea6\u4f18\u5148&#xff0c;\u201c\u4e00\u6761\u8def\u8d70\u5230\u9ed1\u201d&#xff0c;\u9002\u5408\u5224\u65ad\u8fde\u901a\u6027&#xff08;\u662f\u5426\u5b58\u5728\u8def\u5f84&#xff09;&#xff1b;<\/li>\n<li id=\"uc856121a\">BFS&#xff1a;\u5e7f\u5ea6\u4f18\u5148&#xff0c;\u201c\u5730\u6bef\u5f0f\u5c42\u5c42\u63a8\u8fdb\u201d&#xff0c;\u9002\u5408\u6c42\u89e3\u6700\u77ed\u8def\u5f84&#xff08;\u65e0\u6743\u56fe&#xff09;\u3002<\/li>\n<\/ul>\n<h4 id=\"pMTCn\">1.3 \u4e0e\u4e8c\u53c9\u6811\u904d\u5386\u7684\u5173\u8054\u4e0e\u5dee\u5f02<\/h4>\n<p id=\"u6e5194fc\">\u4e8c\u53c9\u6811\u7684\u524d\/\u4e2d\/\u540e\u5e8f\u904d\u5386\u672c\u8d28\u662f\u7279\u6b8a\u7684\u56fe\u904d\u5386&#xff08;\u4e8c\u53c9\u6811\u662f\u65e0\u73af\u7684\u8fde\u901a\u56fe&#xff09;&#xff0c;\u4f46\u56fe\u7684\u904d\u5386\u66f4\u590d\u6742&#xff0c;\u5dee\u5f02\u5982\u4e0b&#xff1a;<\/p>\n<table id=\"GAx2x\">\n<tbody>\n<tr>\n<td>\n<p id=\"u9676e202\">\u5bf9\u6bd4\u7ef4\u5ea6<\/p>\n<\/td>\n<td>\n<p id=\"uae83e62c\">\u4e8c\u53c9\u6811\u904d\u5386<\/p>\n<\/td>\n<td>\n<p id=\"u1b5b2183\">\u56fe\u7684\u904d\u5386<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u7cae0df3\">\u7ed3\u6784\u7279\u6027<\/p>\n<\/td>\n<td>\n<p id=\"u458caaed\">\u65e0\u73af\u3001\u4e00\u5bf9\u591a\u3001\u8fde\u901a<\/p>\n<\/td>\n<td>\n<p id=\"u03ea2cf5\">\u53ef\u80fd\u6709\u73af\u3001\u591a\u5bf9\u591a\u3001\u53ef\u80fd\u975e\u8fde\u901a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u33431969\">\u8bbf\u95ee\u6807\u8bb0<\/p>\n<\/td>\n<td>\n<p id=\"ua7291cce\">\u65e0\u9700&#xff08;\u65e0\u91cd\u590d\u8def\u5f84&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"u673d1e2e\">\u5fc5\u987b\u6709&#xff08;\u6570\u7ec4\/\u96c6\u5408\u6807\u8bb0&#xff0c;\u907f\u514d\u73af\u5bfc\u81f4\u91cd\u590d\u8bbf\u95ee&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u0d613683\">\u8f85\u52a9\u7ed3\u6784<\/p>\n<\/td>\n<td>\n<p id=\"ue6d3acd2\">\u9012\u5f52&#xff08;\u9690\u5f0f\u6808&#xff09;\/\u663e\u5f0f\u6808<\/p>\n<\/td>\n<td>\n<p id=\"ud77399eb\">DFS\u7528\u6808\u3001BFS\u7528\u961f\u5217<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uc247dd7d\">\u904d\u5386\u7ed3\u679c<\/p>\n<\/td>\n<td>\n<p id=\"u3e719f78\">\u552f\u4e00&#xff08;\u56fa\u5b9a\u5de6\u53f3\u5b50\u6811\u987a\u5e8f&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"ue9b32ca9\">\u4e0d\u552f\u4e00&#xff08;\u4f9d\u8d56\u90bb\u63a5\u9876\u70b9\u7684\u8bbf\u95ee\u987a\u5e8f&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"jOR8M\">\u4e8c\u3001\u6df1\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;DFS&#xff0c;Depth First Search&#xff09;<\/h3>\n<h4 id=\"oSZJE\">2.1 \u601d\u60f3<\/h4>\n<p id=\"uf9fc9471\">DFS\u7684\u662f\u201c\u6df1\u5ea6\u4f18\u5148&#xff0c;\u56de\u6eaf\u63a2\u7d22\u201d&#xff0c;\u7c7b\u4f3c\u8d70\u8ff7\u5bab&#xff1a;\u4ece\u8d77\u70b9\u51fa\u53d1&#xff0c;\u9009\u62e9\u4e00\u4e2a\u65b9\u5411\u4e00\u76f4\u5f80\u524d\u8d70&#xff0c;\u76f4\u5230\u8d70\u5230\u201c\u6b7b\u80e1\u540c\u201d&#xff08;\u5f53\u524d\u9876\u70b9\u65e0\u672a\u8bbf\u95ee\u7684\u90bb\u63a5\u9876\u70b9&#xff09;&#xff0c;\u518d\u56de\u6eaf\u5230\u4e0a\u4e00\u4e2a\u9876\u70b9&#xff0c;\u5c1d\u8bd5\u5176\u4ed6\u672a\u8d70\u7684\u65b9\u5411&#xff0c;\u76f4\u5230\u904d\u5386\u6240\u6709\u9876\u70b9\u3002<br \/>\n\u7b80\u5355\u603b\u7ed3&#xff1a;\u5148\u6df1\u540e\u5e7f&#xff0c;\u9047\u963b\u56de\u6eaf\u3002<\/p>\n<h4 id=\"BaZ57\">2.2 \u5b9e\u73b0\u4f9d\u8d56<\/h4>\n<p id=\"u377ce1b7\">DFS\u7684\u5b9e\u73b0\u4f9d\u8d56\u6808&#xff08;Stack&#xff09;&#xff08;\u540e\u8fdb\u5148\u51faLIFO&#xff09;&#xff0c;\u6709\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f&#xff1a;<\/p>\n<li id=\"u5b7fb64e\">\u9012\u5f52\u5b9e\u73b0&#xff1a;\u5229\u7528JVM\u7684\u65b9\u6cd5\u8c03\u7528\u6808&#xff08;\u9690\u5f0f\u6808&#xff09;&#xff0c;\u4ee3\u7801\u66f4\u7b80\u6d01&#xff0c;\u9002\u5408\u5c0f\u89c4\u6a21\u56fe&#xff1b;<\/li>\n<li id=\"u307dc678\">\u975e\u9012\u5f52\u5b9e\u73b0&#xff1a;\u663e\u5f0f\u521b\u5efa\u6808\u5bf9\u8c61&#xff0c;\u624b\u52a8\u63a7\u5236\u5165\u6808\/\u51fa\u6808&#xff0c;\u9002\u5408\u5927\u89c4\u6a21\u56fe&#xff08;\u907f\u514d\u6808\u6ea2\u51fa&#xff09;\u3002<br \/>\n\u65e0\u8bba\u54ea\u79cd\u65b9\u5f0f&#xff0c;\u90fd\u9700\u8981\u8bbf\u95ee\u6807\u8bb0\u6570\u7ec4\/\u96c6\u5408&#xff08;\u5982visited[]&#xff09;&#xff0c;\u6807\u8bb0\u9876\u70b9\u662f\u5426\u5df2\u88ab\u8bbf\u95ee\u3002<\/li>\n<h4 id=\"mkFoA\">2.3 \u904d\u5386\u6b65\u9aa4&#xff08;\u4ee5\u9876\u70b9A\u4e3a\u8d77\u70b9&#xff0c;\u90bb\u63a5\u9876\u70b9\u6309\u5b57\u6bcd\u5e8f\u8bbf\u95ee&#xff09;<\/h4>\n<p id=\"ufe892e24\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"366\" id=\"YPnwG\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140938-699f02a2196cf.png\" width=\"997\" \/><\/p>\n<p id=\"u31d034d1\">\u4ee5\u5305\u542b\u9876\u70b9A\u3001B\u3001C\u3001D\u3001E\u3001F\u3001G\u3001H\u3001aoyou\u7684\u8fde\u901a\u56fe\u4e3a\u4f8b&#xff0c;\u6b65\u9aa4\u53ef\u6982\u62ec\u4e3a\u201c\u5165\u6808\u6807\u8bb0\u2192\u6df1\u5ea6\u63a2\u7d22\u2192\u6b7b\u80e1\u540c\u51fa\u6808\u2192\u56de\u6eaf\u518d\u63a2\u7d22\u201d&#xff0c;\u5173\u952e\u8282\u70b9&#xff1a;<\/p>\n<li id=\"u606414f8\">\u8d77\u70b9 A \u5165\u9012\u5f52\u8c03\u7528\u6808&#xff0c;\u6807\u8bb0\u5df2\u8bbf\u95ee&#xff0c;\u63a2\u7d22\u90bb\u63a5\u9876\u70b9&#xff08;\u5b57\u6bcd\u5e8f&#xff1a;B\u3001D\u3001G\u3001aoyou&#xff09;&#xff0c;\u9996\u5148\u8bbf\u95ee B&#xff0c;B \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u5033b150\">\u4ece B \u63a2\u7d22\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9&#xff08;\u5b57\u6bcd\u5e8f&#xff1a;E\u3001F&#xff09;&#xff0c;\u9996\u5148\u8bbf\u95ee E&#xff0c;E \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u2d8fe358\">E \u65e0\u90bb\u63a5\u9876\u70b9&#xff08;\u6216\u90bb\u63a5\u70b9\u5747\u65e0\u51fa\u8fb9&#xff09;&#xff0c;\u4e3a\u6b7b\u80e1\u540c&#xff0c;\u56de\u6eaf\u5230 B&#xff1b;<\/li>\n<li id=\"u6b0d6811\">B \u7ee7\u7eed\u63a2\u7d22\u4e0b\u4e00\u4e2a\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 F&#xff0c;F \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u2ac1dae2\">\u4ece F \u63a2\u7d22\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 C&#xff0c;C \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u1f2b9392\">\u4ece C \u63a2\u7d22\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 H&#xff0c;H \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u5fd66301\">H \u65e0\u90bb\u63a5\u9876\u70b9&#xff0c;\u56de\u6eaf\u5230 C&#xff1b;C \u65e0\u5176\u4ed6\u90bb\u63a5\u70b9&#xff0c;\u56de\u6eaf\u5230 F&#xff1b;F \u65e0\u5269\u4f59\u672a\u8bbf\u95ee\u90bb\u63a5\u70b9&#xff0c;\u56de\u6eaf\u5230 B&#xff1b;B \u90bb\u63a5\u70b9\u5df2\u5168\u90e8\u8bbf\u95ee&#xff0c;\u56de\u6eaf\u5230 A&#xff1b;<\/li>\n<li id=\"u2eaa2bd7\">A \u7ee7\u7eed\u63a2\u7d22\u4e0b\u4e00\u4e2a\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 D&#xff0c;D \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u449d2f4b\">D \u7684\u90bb\u63a5\u70b9\u4e3a E \u548c F&#xff0c;\u4f46 E \u548c F \u5747\u5df2\u88ab\u8bbf\u95ee&#xff0c;D \u65e0\u65b0\u8def\u5f84&#xff0c;\u56de\u6eaf\u5230 A&#xff1b;<\/li>\n<li id=\"u550e37e6\">A \u7ee7\u7eed\u63a2\u7d22\u4e0b\u4e00\u4e2a\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 G&#xff0c;G \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"u39ff6d92\">G \u65e0\u90bb\u63a5\u9876\u70b9&#xff0c;\u56de\u6eaf\u5230 A&#xff1b;<\/li>\n<li id=\"u6880efc0\">A \u7ee7\u7eed\u63a2\u7d22\u6700\u540e\u4e00\u4e2a\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9 aoyou&#xff0c;aoyou \u5165\u6808\u6807\u8bb0&#xff1b;<\/li>\n<li id=\"uf2936d07\">aoyou \u7684\u90bb\u63a5\u70b9\u4e3a G&#xff0c;\u4f46 G \u5df2\u88ab\u8bbf\u95ee&#xff0c;aoyou \u65e0\u65b0\u8def\u5f84&#xff0c;\u56de\u6eaf\u5230 A&#xff1b;<\/li>\n<li id=\"ua28d568c\">A \u6240\u6709\u90bb\u63a5\u70b9\u5747\u5df2\u8bbf\u95ee&#xff0c;\u9012\u5f52\u7ed3\u675f&#xff0c;\u904d\u5386\u5b8c\u6210\u3002<\/li>\n<p>\u904d\u5386\u8fc7\u7a0b<\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"402\" id=\"u74e9f774\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140938-699f02a23e7cf.png\" width=\"1217\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"435\" id=\"GuyBp\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140938-699f02a293f27.png\" width=\"1150\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"426\" id=\"u0a5c8350\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140938-699f02a2dc0c9.png\" width=\"1153\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"430\" id=\"u48d6b214\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140939-699f02a321261.png\" width=\"1153\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"405\" id=\"u2f36e8bc\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140939-699f02a368d71.png\" width=\"1146\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"455\" id=\"u845ccc97\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140939-699f02a39f235.png\" width=\"1161\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"454\" id=\"ua76a7650\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140939-699f02a3d9a49.png\" width=\"1136\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"494\" id=\"u53d524fd\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140940-699f02a42027a.png\" width=\"1196\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"471\" id=\"u2084d190\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140940-699f02a45f47a.png\" width=\"1156\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"482\" id=\"u7a794f08\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140940-699f02a4ac92e.png\" width=\"1142\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"472\" id=\"u3b93c624\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140941-699f02a5027e7.png\" width=\"1162\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"477\" id=\"u0039a8a5\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140941-699f02a5411aa.png\" width=\"1159\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"480\" id=\"u3607019a\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140941-699f02a581695.png\" width=\"1156\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"454\" id=\"uf0de1a3f\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140941-699f02a5caa79.png\" width=\"1174\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"482\" id=\"yeilO\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140942-699f02a612a39.png\" width=\"1142\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"463\" id=\"XZMbs\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140942-699f02a657279.png\" width=\"1171\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"474\" id=\"zhqND\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140942-699f02a6a291e.png\" width=\"1160\" \/><\/p>\n<p id=\"uff51c5bf\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"469\" id=\"u1f86d47b\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140942-699f02a6e3c41.png\" width=\"1134\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"445\" id=\"ua9226bbf\" src=\"2026-02-255bqh5jt4ucw.png\" width=\"1155\" \/><\/p>\n<h4 id=\"IMqFs\">2.4 \u4ee3\u7801\u5b9e\u73b0&#xff08;\u90bb\u63a5\u8868\u7248&#xff0c;\u9012\u5f52&#043;\u975e\u9012\u5f52&#xff09;<\/h4>\n<p id=\"uefbe16f8\">\u57fa\u4e8e\u4e4b\u524d\u7684\u90bb\u63a5\u8868\u56fe\u7ed3\u6784&#xff0c;\u5b9e\u73b0DFS\u7684\u9012\u5f52\u7248&#xff08;\u7b80\u6d01&#xff09;\u548c\u975e\u9012\u5f52\u7248&#xff08;\u901a\u7528&#xff09;&#xff0c;\u878d\u5165aoyou\u9876\u70b9&#xff0c;\u8d34\u5408\u793a\u4f8b\u8981\u6c42&#xff1a;<\/p>\n<p>import java.util.*;<\/p>\n<p>\/**<br \/>\n * \u56fe\u7684\u904d\u5386&#xff1a;DFS&#xff08;\u6df1\u5ea6\u4f18\u5148\u641c\u7d22&#xff09;<br \/>\n * \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0&#xff0c;\u5305\u542b\u9012\u5f52&#043;\u975e\u9012\u5f52\u7248&#xff0c;\u878d\u5165aoyou\u9876\u70b9<br \/>\n * &#064;author aoyou<br \/>\n *\/<br \/>\npublic class AoyouGraphDFS {<br \/>\n    \/\/ \u9876\u70b9\u7c7b&#xff1a;\u5c01\u88c5\u9876\u70b9\u540d\u79f0\u548c\u8fb9\u94fe\u8868<br \/>\n    static class Vertex {<br \/>\n        String name;<br \/>\n        Edge next;<br \/>\n        public Vertex(String name, Edge next) {<br \/>\n            this.name &#061; name;<br \/>\n            this.next &#061; next;<br \/>\n        }<br \/>\n    }<br \/>\n    \/\/ \u8fb9\u7c7b&#xff1a;\u5c01\u88c5\u76ee\u6807\u9876\u70b9\u548c\u6743\u503c<br \/>\n    static class Edge {<br \/>\n        String target;<br \/>\n        int weight;<br \/>\n        Edge next;<br \/>\n        public Edge(String target, int weight, Edge next) {<br \/>\n            this.target &#061; target;<br \/>\n            this.weight &#061; weight;<br \/>\n            this.next &#061; next;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private Map&lt;String, Vertex&gt; vertexMap; \/\/ \u5b58\u50a8\u6240\u6709\u9876\u70b9<br \/>\n    private Set&lt;String&gt; visited; \/\/ \u8bbf\u95ee\u6807\u8bb0\u96c6\u5408&#xff0c;\u66ff\u4ee3\u6570\u7ec4&#xff08;\u66f4\u7075\u6d3b&#xff09;<\/p>\n<p>    public AoyouGraphDFS() {<br \/>\n        vertexMap &#061; new HashMap&lt;&gt;();<br \/>\n        visited &#061; new HashSet&lt;&gt;();<br \/>\n    }<\/p>\n<p>    \/\/ \u63d2\u5165\u9876\u70b9<br \/>\n    public void insertVertex(String name) {<br \/>\n        vertexMap.putIfAbsent(name, new Vertex(name, null));<br \/>\n    }<br \/>\n    \/\/ \u63d2\u5165\u6709\u5411\u8fb9&#xff1a;begin\u2192end&#xff0c;\u6743\u503cweight<br \/>\n    public void insertEdge(String begin, String end, int weight) {<br \/>\n        Vertex beginV &#061; vertexMap.get(begin);<br \/>\n        Edge newEdge &#061; new Edge(end, weight, beginV.next);<br \/>\n        beginV.next &#061; newEdge; \/\/ \u5934\u63d2\u6cd5&#xff08;\u4e0d\u5f71\u54cd\u904d\u5386&#xff0c;\u4ec5\u7b80\u5316\u4ee3\u7801&#xff09;<br \/>\n        \/\/ \u65e0\u5411\u56fe\u9700\u989d\u5916\u63d2\u5165end\u2192begin\u7684\u8fb9<br \/>\n        \/\/ insertEdge(end, begin, weight);<br \/>\n    }<\/p>\n<p>    \/\/ \u3010DFS\u9012\u5f52\u7248\u3011\u4ece\u6307\u5b9a\u8d77\u70b9\u5f00\u59cb\u904d\u5386<br \/>\n    public void dfsRecursive(String start) {<br \/>\n        if (!vertexMap.containsKey(start) || visited.contains(start)) {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ 1. \u8bbf\u95ee\u5f53\u524d\u9876\u70b9&#xff1a;\u6253\u5370&#043;\u6807\u8bb0<br \/>\n        System.out.print(start &#043; &#034; \u2192 &#034;);<br \/>\n        visited.add(start);<br \/>\n        \/\/ 2. \u904d\u5386\u5f53\u524d\u9876\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9&#xff0c;\u9012\u5f52\u8bbf\u95ee\u672a\u6807\u8bb0\u7684\u9876\u70b9<br \/>\n        Vertex current &#061; vertexMap.get(start);<br \/>\n        Edge edge &#061; current.next;<br \/>\n        \/\/ \u6309\u5b57\u6bcd\u5e8f\u6392\u5e8f\u90bb\u63a5\u9876\u70b9&#xff08;\u4fdd\u8bc1\u904d\u5386\u987a\u5e8f\u4e00\u81f4&#xff09;<br \/>\n        List&lt;String&gt; neighbors &#061; new ArrayList&lt;&gt;();<br \/>\n        while (edge !&#061; null) {<br \/>\n            neighbors.add(edge.target);<br \/>\n            edge &#061; edge.next;<br \/>\n        }<br \/>\n        Collections.sort(neighbors);<br \/>\n        \/\/ \u9012\u5f52\u8bbf\u95ee\u6bcf\u4e2a\u90bb\u63a5\u9876\u70b9<br \/>\n        for (String neighbor : neighbors) {<br \/>\n            if (!visited.contains(neighbor)) {<br \/>\n                dfsRecursive(neighbor);<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ \u3010DFS\u975e\u9012\u5f52\u7248\u3011\u4ece\u6307\u5b9a\u8d77\u70b9\u5f00\u59cb\u904d\u5386&#xff08;\u663e\u5f0f\u6808&#xff09;<br \/>\n    public void dfsNonRecursive(String start) {<br \/>\n        if (!vertexMap.containsKey(start)) {<br \/>\n            return;<br \/>\n        }<br \/>\n        Stack&lt;String&gt; stack &#061; new Stack&lt;&gt;();<br \/>\n        Set&lt;String&gt; visited &#061; new HashSet&lt;&gt;();<br \/>\n        \/\/ 1. \u8d77\u70b9\u5165\u6808&#043;\u6807\u8bb0<br \/>\n        stack.push(start);<br \/>\n        visited.add(start);<br \/>\n        System.out.print(&#034;\u975e\u9012\u5f52DFS&#xff1a;&#034;);<br \/>\n        while (!stack.isEmpty()) {<br \/>\n            \/\/ 2. \u51fa\u6808\u5e76\u8bbf\u95ee\u5f53\u524d\u9876\u70b9<br \/>\n            String current &#061; stack.pop();<br \/>\n            System.out.print(current &#043; &#034; \u2192 &#034;);<br \/>\n            \/\/ 3. \u904d\u5386\u90bb\u63a5\u9876\u70b9&#xff0c;\u672a\u6807\u8bb0\u7684\u5165\u6808&#043;\u6807\u8bb0&#xff08;\u9006\u5e8f\u5165\u6808&#xff0c;\u4fdd\u8bc1\u8bbf\u95ee\u987a\u5e8f\u4e3a\u5b57\u6bcd\u5e8f&#xff09;<br \/>\n            Vertex v &#061; vertexMap.get(current);<br \/>\n            Edge edge &#061; v.next;<br \/>\n            List&lt;String&gt; neighbors &#061; new ArrayList&lt;&gt;();<br \/>\n            while (edge !&#061; null) {<br \/>\n                neighbors.add(edge.target);<br \/>\n                edge &#061; edge.next;<br \/>\n            }<br \/>\n            Collections.sort(neighbors, Collections.reverseOrder()); \/\/ \u9006\u5e8f<br \/>\n            for (String neighbor : neighbors) {<br \/>\n                if (!visited.contains(neighbor)) {<br \/>\n                    stack.push(neighbor);<br \/>\n                    visited.add(neighbor);<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ \u91cd\u7f6e\u8bbf\u95ee\u6807\u8bb0&#xff08;\u591a\u6b21\u904d\u5386\u7528&#xff09;<br \/>\n    public void resetVisited() {<br \/>\n        visited.clear();<br \/>\n    }<\/p>\n<p>    \/\/ \u6d4b\u8bd5\u793a\u4f8b&#xff08;\u65e0\u5411\u56fe\u9700\u6ce8\u91ca\u6389\u8fb9\u7684\u5355\u5411\u63d2\u5165&#xff09;<br \/>\n    public static void main(String[] args) {<br \/>\n        AoyouGraphDFS graph &#061; new AoyouGraphDFS();<br \/>\n        \/\/ 1. \u63d2\u5165\u9876\u70b9&#xff08;\u5305\u542bA\u3001B\u3001C\u3001D\u3001E\u3001F\u3001G\u3001H\u3001aoyou&#xff09;<br \/>\n        String[] vertexes &#061; {&#034;A&#034;, &#034;B&#034;, &#034;C&#034;, &#034;D&#034;, &#034;E&#034;, &#034;F&#034;, &#034;G&#034;, &#034;H&#034;, &#034;aoyou&#034;};<br \/>\n        for (String v : vertexes) {<br \/>\n            graph.insertVertex(v);<br \/>\n        }<br \/>\n        \/\/ 2. \u63d2\u5165\u6709\u5411\u8fb9&#xff08;\u6a21\u62df\u8fde\u901a\u56fe&#xff09;<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;B&#034;, 4);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;D&#034;, 5);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;G&#034;, 1);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;aoyou&#034;, 8);<br \/>\n        graph.insertEdge(&#034;B&#034;, &#034;E&#034;, 2);<br \/>\n        graph.insertEdge(&#034;B&#034;, &#034;F&#034;, 3);<br \/>\n        graph.insertEdge(&#034;D&#034;, &#034;F&#034;, 4);<br \/>\n        graph.insertEdge(&#034;D&#034;, &#034;E&#034;, 3);<br \/>\n        graph.insertEdge(&#034;F&#034;, &#034;C&#034;, 2);<br \/>\n        graph.insertEdge(&#034;C&#034;, &#034;H&#034;, 5);<br \/>\n        graph.insertEdge(&#034;aoyou&#034;, &#034;G&#034;, 2); \/\/ aoyou\u8fde\u63a5G<\/p>\n<p>        \/\/ 3. \u9012\u5f52\u7248DFS&#xff08;\u8d77\u70b9A&#xff09;<br \/>\n        System.out.print(&#034;\u9012\u5f52\u7248DFS&#xff1a;&#034;);<br \/>\n        graph.dfsRecursive(&#034;A&#034;);<br \/>\n        System.out.println(&#034;\u7ed3\u675f&#034;);<\/p>\n<p>        \/\/ 4. \u975e\u9012\u5f52\u7248DFS&#xff08;\u8d77\u70b9A&#xff09;<br \/>\n        graph.dfsNonRecursive(&#034;A&#034;);<br \/>\n        System.out.println(&#034;\u7ed3\u675f&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<h4 id=\"UbZNV\">2.5 \u8fd0\u884c\u7ed3\u679c<\/h4>\n<p>\u9012\u5f52\u7248DFS&#xff1a;A \u2192 B \u2192 E \u2192 F \u2192 C \u2192 H \u2192 D \u2192 G \u2192 aoyou \u2192 \u7ed3\u675f<br \/>\n\u975e\u9012\u5f52DFS&#xff1a;A \u2192 B \u2192 E \u2192 F \u2192 C \u2192 H \u2192 D \u2192 G \u2192 aoyou \u2192 \u7ed3\u675f<\/p>\n<p id=\"u57a4299c\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1020\" id=\"u266846b1\" src=\"2026-02-25co4vbbrl2bh.png\" width=\"1920\" \/><\/p>\n<h4 id=\"XgT6H\">2.6 \u65f6\u95f4\u590d\u6742\u5ea6<\/h4>\n<p id=\"ue9d762dd\">DFS\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0e\u56fe\u7684\u5b58\u50a8\u65b9\u5f0f\u76f8\u5173&#xff0c;\u53d6\u51b3\u4e8e\u8bbf\u95ee\u6240\u6709\u9876\u70b9\u548c\u904d\u5386\u6240\u6709\u8fb9\u7684\u5f00\u9500&#xff1a;<\/p>\n<li id=\"u0380c198\">\u90bb\u63a5\u8868\u5b58\u50a8&#xff1a;\u8bbf\u95ee\u6240\u6709\u9876\u70b9\u8017\u65f6\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"2026-02-251s34bdsorlv.png\" width=\"534\" \/><\/p>\n<p>&#xff08;V\u4e3a\u9876\u70b9\u6570&#xff09;&#xff0c;\u904d\u5386\u6240\u6709\u8fb9\u8017\u65f6<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"2026-02-25wxepljwhg1z.png\" width=\"534\" \/><\/p>\n<p>&#xff08;E\u4e3a\u8fb9\u6570&#xff09;&#xff0c;\u603b\u65f6\u95f4\u590d\u6742\u5ea6<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"2026-02-25rqdfpqn2qdn.png\" width=\"534\" \/><\/p>\n<p>&#xff1b;<\/li>\n<li id=\"u16e934e9\">\u90bb\u63a5\u77e9\u9635\u5b58\u50a8&#xff1a;\u67e5\u627e\u6bcf\u4e2a\u9876\u70b9\u7684\u90bb\u63a5\u9876\u70b9\u9700\u904d\u5386\u6574\u884c&#xff0c;\u8017\u65f6\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"2026-02-25ayolvhd1n2m.png\" width=\"534\" \/><\/p>\n<p>&#xff0c;\u603b\u65f6\u95f4\u590d\u6742\u5ea6<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"2026-02-25ptgangpmwhn.png\" width=\"534\" \/><\/p>\n<p>\u3002<\/li>\n<h4 id=\"Azxge\">2.7 \u5e94\u7528\u573a\u666f<\/h4>\n<p id=\"ud79dad60\">DFS\u4e13\u6ce8\u4e8e\u201c\u662f\u5426\u5b58\u5728\u8def\u5f84\u201d&#xff0c;\u4e0d\u5173\u5fc3\u8def\u5f84\u957f\u5ea6&#xff0c;\u5178\u578b\u5e94\u7528&#xff1a;<\/p>\n<ul>\n<li id=\"u4ff35ee1\">\u5224\u65ad\u56fe\u7684\u8fde\u901a\u6027&#xff08;\u65e0\u5411\u56fe\u662f\u5426\u4e3a\u8fde\u901a\u56fe\u3001\u6709\u5411\u56fe\u662f\u5426\u5f3a\u8fde\u901a&#xff09;&#xff1b;<\/li>\n<li id=\"u5edfe6ee\">\u5bfb\u627e\u56fe\u4e2d\u7684\u73af&#xff08;\u5982\u68c0\u6d4b\u4efb\u52a1\u4f9d\u8d56\u662f\u5426\u6709\u5faa\u73af&#xff09;&#xff1b;<\/li>\n<li id=\"ua01ccb5e\">\u62d3\u6251\u6392\u5e8f&#xff08;\u6709\u5411\u65e0\u73af\u56feDAG&#xff09;\u3001\u8ff7\u5bab\u63a2\u7d22\u3001\u6392\u5217\u7ec4\u5408\u95ee\u9898&#xff1b;<\/li>\n<li id=\"ubda43be3\">\u6df1\u5ea6\u4f18\u5148\u7684\u641c\u7d22\u904d\u5386&#xff08;\u5982\u6587\u4ef6\u5939\u7684\u9012\u5f52\u904d\u5386&#xff0c;\u672c\u8d28\u662f\u6811\u7684DFS&#xff09;\u3002<\/li>\n<\/ul>\n<h3 id=\"pIacF\">\u4e09\u3001\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;BFS&#xff0c;Breadth First Search&#xff09;<\/h3>\n<h4 id=\"iIZ4e\">3.1 \u601d\u60f3<\/h4>\n<p id=\"uec8063b5\">BFS\u7684\u662f\u201c\u5e7f\u5ea6\u4f18\u5148&#xff0c;\u5c42\u5c42\u63a8\u8fdb\u201d&#xff0c;\u7c7b\u4f3c\u6c34\u9762\u6ce2\u7eb9\u6269\u6563&#xff1a;\u4ece\u8d77\u70b9\u51fa\u53d1&#xff0c;\u5148\u8bbf\u95ee\u8d77\u70b9\u7684\u6240\u6709\u90bb\u63a5\u9876\u70b9&#xff08;\u7b2c\u4e00\u5c42&#xff09;&#xff0c;\u518d\u4f9d\u6b21\u8bbf\u95ee\u7b2c\u4e00\u5c42\u6bcf\u4e2a\u9876\u70b9\u7684\u90bb\u63a5\u9876\u70b9&#xff08;\u7b2c\u4e8c\u5c42&#xff09;&#xff0c;\u4ee5\u6b64\u7c7b\u63a8&#xff0c;\u76f4\u5230\u904d\u5386\u6240\u6709\u9876\u70b9\u3002<br \/>\n\u7b80\u5355\u603b\u7ed3&#xff1a;\u5148\u5e7f\u540e\u6df1&#xff0c;\u5c42\u5c42\u904d\u5386\u3002<\/p>\n<h4 id=\"CTGnQ\">3.2 \u5b9e\u73b0\u4f9d\u8d56<\/h4>\n<p id=\"u4719763c\">BFS\u7684\u5b9e\u73b0\u4f9d\u8d56\u961f\u5217&#xff08;Queue&#xff09;&#xff08;\u5148\u8fdb\u5148\u51faFIFO&#xff09;&#xff0c;\u5fc5\u987b\u663e\u5f0f\u5b9e\u73b0&#xff08;\u65e0\u9012\u5f52\u7248&#xff09;&#xff0c;\u540c\u65f6\u9700\u8981\u8bbf\u95ee\u6807\u8bb0\u6570\u7ec4\/\u96c6\u5408&#xff0c;\u539f\u56e0&#xff1a;\u961f\u5217\u4fdd\u8bc1\u201c\u5c42\u5c42\u63a8\u8fdb\u201d\u7684\u987a\u5e8f&#xff0c;\u6807\u8bb0\u907f\u514d\u540c\u4e00\u9876\u70b9\u88ab\u591a\u6b21\u5165\u961f\u3002<\/p>\n<h4 id=\"RGzFI\">3.3 \u904d\u5386\u6b65\u9aa4&#xff08;\u4ee5\u9876\u70b9A\u4e3a\u8d77\u70b9&#xff0c;\u90bb\u63a5\u9876\u70b9\u6309\u5b57\u6bcd\u5e8f\u5165\u961f&#xff09;<\/h4>\n<p id=\"u1fd0a944\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"366\" id=\"ud4b99ba3\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140938-699f02a2196cf.png\" width=\"997\" \/><\/p>\n<p id=\"u36bcd6af\">\u4ee5\u4e0a\u8ff0\u8fde\u901a\u56fe\u4e3a\u4f8b&#xff0c;BFS\u7684\u662f\u201c\u5165\u961f\u6807\u8bb0\u2192\u51fa\u961f\u8bbf\u95ee\u2192\u90bb\u63a5\u9876\u70b9\u5165\u961f\u6807\u8bb0\u201d&#xff0c;\u5c42\u5c42\u904d\u5386&#xff1a;<\/p>\n<li id=\"u7a708f3f\">\u8d77\u70b9A\u5165\u961f&#xff0c;\u6807\u8bb0\u5df2\u8bbf\u95ee&#xff1b;<\/li>\n<li id=\"uf02643dd\">A\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u5c06A\u7684\u90bb\u63a5\u9876\u70b9B\u3001D\u3001G\u3001aoyou&#xff08;\u5b57\u6bcd\u5e8f&#xff09;\u4f9d\u6b21\u5165\u961f&#xff0c;\u6807\u8bb0\u5df2\u8bbf\u95ee&#xff08;\u7b2c\u4e00\u5c42&#xff09;&#xff1b;<\/li>\n<li id=\"ub2167b40\">B\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u5c06B\u7684\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9E\u3001F\u5165\u961f&#xff0c;\u6807\u8bb0&#xff08;\u7b2c\u4e8c\u5c42&#xff09;&#xff1b;<\/li>\n<li id=\"u9b0a7d4c\">D\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u5176\u90bb\u63a5\u9876\u70b9\u5747\u5df2\u6807\u8bb0&#xff0c;\u65e0\u5165\u961f&#xff1b;G\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u65e0\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9&#xff1b;aoyou\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u65e0\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9&#xff1b;<\/li>\n<li id=\"u426413d7\">E\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u65e0\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9&#xff1b;F\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u5c06F\u7684\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9C\u5165\u961f&#xff0c;\u6807\u8bb0&#xff08;\u7b2c\u4e09\u5c42&#xff09;&#xff1b;<\/li>\n<li id=\"u308b836c\">C\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u5c06C\u7684\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9H\u5165\u961f&#xff0c;\u6807\u8bb0&#xff08;\u7b2c\u56db\u5c42&#xff09;&#xff1b;<\/li>\n<li id=\"uc84a4f3a\">H\u51fa\u961f\u5e76\u8bbf\u95ee&#xff0c;\u65e0\u672a\u8bbf\u95ee\u90bb\u63a5\u9876\u70b9&#xff1b;\u961f\u5217\u4e3a\u7a7a&#xff0c;\u904d\u5386\u7ed3\u675f\u3002<\/li>\n<p>\u904d\u5386\u8fc7\u7a0b<\/p>\n<p id=\"u7e871871\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"491\" id=\"u99460eb9\" src=\"2026-02-25q3mm4huolff.png\" width=\"1200\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"478\" id=\"ubc2cab7f\" src=\"2026-02-25p1iywkcjhsw.png\" width=\"1146\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"482\" id=\"u7e3d133b\" src=\"2026-02-25l30x4rk0yrd.png\" width=\"1383\" \/><\/p>\n<p id=\"u7e871871\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"473\" id=\"u44ce77c8\" src=\"2026-02-25g3iao0wmt3j.png\" width=\"1393\" \/><\/p>\n<p id=\"u2c1e1c9e\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"483\" id=\"ud64af86d\" src=\"2026-02-25axqjjkebrm2.png\" width=\"1383\" \/><\/p>\n<p id=\"u2c1e1c9e\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"487\" id=\"u1d7a8808\" src=\"2026-02-25yrenspwscxx.png\" width=\"1395\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"476\" id=\"uf1cab1b6\" src=\"2026-02-250wkxdcxsn0c.png\" width=\"1370\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"489\" id=\"u84cd5a30\" src=\"2026-02-25ey1umkfff0l.png\" width=\"1367\" \/><\/p>\n<p id=\"u2c1e1c9e\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"474\" id=\"u351ff463\" src=\"2026-02-25nuz4sbdju0d.png\" width=\"1392\" \/><\/p>\n<h4 id=\"CRuQ3\">3.4 \u4ee3\u7801\u5b9e\u73b0&#xff08;\u90bb\u63a5\u8868\u7248&#xff0c;\u6c42\u89e3\u6700\u77ed\u8def\u5f84&#xff09;<\/h4>\n<p id=\"u28e6266c\">\u57fa\u4e8e\u540c\u4e00\u90bb\u63a5\u8868\u7ed3\u6784&#xff0c;\u5b9e\u73b0BFS\u904d\u5386&#xff0c;\u5e76\u589e\u52a0\u65e0\u6743\u56fe\u6700\u77ed\u8def\u5f84\u6c42\u89e3\u529f\u80fd&#xff08;BFS\u7684\u7ecf\u5178\u5e94\u7528&#xff09;&#xff1a;<\/p>\n<p>import java.util.*;<\/p>\n<p>\/**<br \/>\n * \u56fe\u7684\u904d\u5386&#xff1a;BFS&#xff08;\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22&#xff09;<br \/>\n * \u57fa\u4e8e\u90bb\u63a5\u8868\u5b9e\u73b0&#xff0c;\u542b\u904d\u5386&#043;\u65e0\u6743\u56fe\u6700\u77ed\u8def\u5f84\u6c42\u89e3<br \/>\n * &#064;author aoyou<br \/>\n *\/<br \/>\npublic class AoyouGraphBFS {<br \/>\n    \/\/ \u590d\u7528\u9876\u70b9\u7c7b\u548c\u8fb9\u7c7b&#xff08;\u4e0eDFS\u4e00\u81f4&#xff0c;\u7701\u7565&#xff09;<br \/>\n    static class Vertex {<br \/>\n        String name;<br \/>\n        Edge next;<br \/>\n        public Vertex(String name, Edge next) {<br \/>\n            this.name &#061; name;<br \/>\n            this.next &#061; next;<br \/>\n        }<br \/>\n    }<br \/>\n    static class Edge {<br \/>\n        String target;<br \/>\n        int weight;<br \/>\n        Edge next;<br \/>\n        public Edge(String target, int weight, Edge next) {<br \/>\n            this.target &#061; target;<br \/>\n            this.weight &#061; weight;<br \/>\n            this.next &#061; next;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private Map&lt;String, Vertex&gt; vertexMap;<\/p>\n<p>    public AoyouGraphBFS() {<br \/>\n        vertexMap &#061; new HashMap&lt;&gt;();<br \/>\n    }<\/p>\n<p>    \/\/ \u63d2\u5165\u9876\u70b9\u3001\u63d2\u5165\u8fb9&#xff08;\u4e0eDFS\u4e00\u81f4&#xff0c;\u7701\u7565&#xff09;<br \/>\n    public void insertVertex(String name) {<br \/>\n        vertexMap.putIfAbsent(name, new Vertex(name, null));<br \/>\n    }<br \/>\n    public void insertEdge(String begin, String end, int weight) {<br \/>\n        Vertex beginV &#061; vertexMap.get(begin);<br \/>\n        Edge newEdge &#061; new Edge(end, weight, beginV.next);<br \/>\n        beginV.next &#061; newEdge;<br \/>\n        \/\/ \u65e0\u5411\u56fe\u8bf7\u6dfb\u52a0&#xff1a;insertEdge(end, begin, weight);<br \/>\n    }<\/p>\n<p>    \/\/ \u3010BFS\u904d\u5386\u3011\u4ece\u6307\u5b9a\u8d77\u70b9\u904d\u5386\u6240\u6709\u9876\u70b9<br \/>\n    public void bfsTraverse(String start) {<br \/>\n        if (!vertexMap.containsKey(start)) {<br \/>\n            System.out.println(&#034;\u8d77\u70b9\u9876\u70b9\u4e0d\u5b58\u5728&#xff01;&#034;);<br \/>\n            return;<br \/>\n        }<br \/>\n        Queue&lt;String&gt; queue &#061; new LinkedList&lt;&gt;();<br \/>\n        Set&lt;String&gt; visited &#061; new HashSet&lt;&gt;();<br \/>\n        \/\/ \u8d77\u70b9\u5165\u961f&#043;\u6807\u8bb0<br \/>\n        queue.offer(start);<br \/>\n        visited.add(start);<br \/>\n        System.out.print(&#034;BFS\u904d\u5386\u5e8f\u5217&#xff1a;&#034;);<br \/>\n        while (!queue.isEmpty()) {<br \/>\n            \/\/ \u51fa\u961f\u5e76\u8bbf\u95ee\u5f53\u524d\u9876\u70b9<br \/>\n            String current &#061; queue.poll();<br \/>\n            System.out.print(current &#043; &#034; \u2192 &#034;);<br \/>\n            \/\/ \u904d\u5386\u90bb\u63a5\u9876\u70b9&#xff0c;\u672a\u6807\u8bb0\u7684\u5165\u961f&#043;\u6807\u8bb0&#xff08;\u6309\u5b57\u6bcd\u5e8f&#xff09;<br \/>\n            Vertex v &#061; vertexMap.get(current);<br \/>\n            Edge edge &#061; v.next;<br \/>\n            List&lt;String&gt; neighbors &#061; new ArrayList&lt;&gt;();<br \/>\n            while (edge !&#061; null) {<br \/>\n                neighbors.add(edge.target);<br \/>\n                edge &#061; edge.next;<br \/>\n            }<br \/>\n            Collections.sort(neighbors);<br \/>\n            for (String neighbor : neighbors) {<br \/>\n                if (!visited.contains(neighbor)) {<br \/>\n                    queue.offer(neighbor);<br \/>\n                    visited.add(neighbor);<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        System.out.println(&#034;\u7ed3\u675f&#034;);<br \/>\n    }<\/p>\n<p>    \/\/ \u3010BFS\u7ecf\u5178\u5e94\u7528\u3011\u6c42\u89e3\u65e0\u6743\u56fe\u4e2d\u8d77\u70b9\u5230\u76ee\u6807\u9876\u70b9\u7684\u6700\u77ed\u8def\u5f84&#xff08;\u8fb9\u6570&#xff09;<br \/>\n    public int bfsShortestPath(String start, String target) {<br \/>\n        if (!vertexMap.containsKey(start) || !vertexMap.containsKey(target)) {<br \/>\n            return -1; \/\/ \u9876\u70b9\u4e0d\u5b58\u5728&#xff0c;\u8fd4\u56de-1\u8868\u793a\u4e0d\u53ef\u8fbe<br \/>\n        }<br \/>\n        if (start.equals(target)) {<br \/>\n            return 0; \/\/ \u8d77\u70b9&#061;\u76ee\u6807&#xff0c;\u8def\u5f84\u957f\u5ea60<br \/>\n        }<br \/>\n        Queue&lt;String&gt; queue &#061; new LinkedList&lt;&gt;();<br \/>\n        Set&lt;String&gt; visited &#061; new HashSet&lt;&gt;();<br \/>\n        Map&lt;String, Integer&gt; pathLen &#061; new HashMap&lt;&gt;(); \/\/ \u8bb0\u5f55\u6bcf\u4e2a\u9876\u70b9\u5230\u8d77\u70b9\u7684\u8def\u5f84\u957f\u5ea6<br \/>\n        \/\/ \u521d\u59cb\u5316<br \/>\n        queue.offer(start);<br \/>\n        visited.add(start);<br \/>\n        pathLen.put(start, 0);<\/p>\n<p>        while (!queue.isEmpty()) {<br \/>\n            String current &#061; queue.poll();<br \/>\n            \/\/ \u904d\u5386\u90bb\u63a5\u9876\u70b9<br \/>\n            Vertex v &#061; vertexMap.get(current);<br \/>\n            Edge edge &#061; v.next;<br \/>\n            while (edge !&#061; null) {<br \/>\n                String neighbor &#061; edge.target;<br \/>\n                if (neighbor.equals(target)) {<br \/>\n                    return pathLen.get(current) &#043; 1; \/\/ \u627e\u5230\u76ee\u6807&#xff0c;\u8fd4\u56de\u8def\u5f84\u957f\u5ea6<br \/>\n                }<br \/>\n                if (!visited.contains(neighbor)) {<br \/>\n                    visited.add(neighbor);<br \/>\n                    queue.offer(neighbor);<br \/>\n                    pathLen.put(neighbor, pathLen.get(current) &#043; 1);<br \/>\n                }<br \/>\n                edge &#061; edge.next;<br \/>\n            }<br \/>\n        }<br \/>\n        return -1; \/\/ \u65e0\u8def\u5f84\u53ef\u8fbe<br \/>\n    }<\/p>\n<p>    \/\/ \u6d4b\u8bd5\u793a\u4f8b<br \/>\n    public static void main(String[] args) {<br \/>\n        AoyouGraphBFS graph &#061; new AoyouGraphBFS();<br \/>\n        \/\/ 1. \u63d2\u5165\u9876\u70b9&#xff08;A\u3001B\u3001C\u3001D\u3001E\u3001F\u3001G\u3001H\u3001aoyou&#xff09;<br \/>\n        String[] vertexes &#061; {&#034;A&#034;, &#034;B&#034;, &#034;C&#034;, &#034;D&#034;, &#034;E&#034;, &#034;F&#034;, &#034;G&#034;, &#034;H&#034;, &#034;aoyou&#034;};<br \/>\n        for (String v : vertexes) {<br \/>\n            graph.insertVertex(v);<br \/>\n        }<br \/>\n        \/\/ 2. \u63d2\u5165\u6709\u5411\u8fb9<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;B&#034;, 4);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;D&#034;, 5);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;G&#034;, 1);<br \/>\n        graph.insertEdge(&#034;A&#034;, &#034;aoyou&#034;, 8);<br \/>\n        graph.insertEdge(&#034;B&#034;, &#034;E&#034;, 2);<br \/>\n        graph.insertEdge(&#034;B&#034;, &#034;F&#034;, 3);<br \/>\n        graph.insertEdge(&#034;D&#034;, &#034;F&#034;, 4);<br \/>\n        graph.insertEdge(&#034;D&#034;, &#034;E&#034;, 3);<br \/>\n        graph.insertEdge(&#034;F&#034;, &#034;C&#034;, 2);<br \/>\n        graph.insertEdge(&#034;C&#034;, &#034;H&#034;, 5);<br \/>\n        graph.insertEdge(&#034;aoyou&#034;, &#034;G&#034;, 2);<\/p>\n<p>        \/\/ 3. BFS\u904d\u5386&#xff08;\u8d77\u70b9A&#xff09;<br \/>\n        graph.bfsTraverse(&#034;A&#034;);<\/p>\n<p>        \/\/ 4. \u6c42\u89e3\u6700\u77ed\u8def\u5f84&#xff08;\u65e0\u6743\u56fe&#xff09;<br \/>\n        System.out.println(&#034;A\u5230aoyou\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;&#034; &#043; graph.bfsShortestPath(&#034;A&#034;, &#034;aoyou&#034;));<br \/>\n        System.out.println(&#034;A\u5230H\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;&#034; &#043; graph.bfsShortestPath(&#034;A&#034;, &#034;H&#034;));<br \/>\n        System.out.println(&#034;aoyou\u5230H\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;&#034; &#043; graph.bfsShortestPath(&#034;aoyou&#034;, &#034;H&#034;));<br \/>\n    }<br \/>\n}<\/p>\n<h4 id=\"cp1K7\">3.5 \u8fd0\u884c\u7ed3\u679c<\/h4>\n<p>BFS\u904d\u5386\u5e8f\u5217&#xff1a;A \u2192 B \u2192 D \u2192 G \u2192 aoyou \u2192 E \u2192 F \u2192 C \u2192 H \u2192 \u7ed3\u675f<br \/>\nA\u5230aoyou\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;1<br \/>\nA\u5230H\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;4<br \/>\naoyou\u5230H\u7684\u6700\u77ed\u8def\u5f84\u957f\u5ea6&#xff1a;-1<\/p>\n<p id=\"u93ad7b92\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1020\" id=\"ua9414dc4\" src=\"2026-02-25hnzzykii5b1.png\" width=\"1920\" \/><\/p>\n<h4 id=\"w9hel\">3.6 \u65f6\u95f4\u590d\u6742\u5ea6<\/h4>\n<p id=\"ue4dc4043\">BFS\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e0eDFS\u5b8c\u5168\u4e00\u81f4&#xff0c;\u4ec5\u4f9d\u8d56\u5b58\u50a8\u65b9\u5f0f&#xff0c;\u4e0e\u904d\u5386\u7b56\u7565\u65e0\u5173&#xff1a;<\/p>\n<li id=\"ue83d07c0\">\u90bb\u63a5\u8868\u5b58\u50a8&#xff1a;\u8bbf\u95ee\u9876\u70b9 &#043; \u904d\u5386\u8fb9 \u2192 \u603b&#xff1b;<\/li>\n<li id=\"u57533e08\">\u90bb\u63a5\u77e9\u9635\u5b58\u50a8&#xff1a;\u67e5\u627e\u90bb\u63a5\u9876\u70b9 \u2192 \u603b\u3002<\/li>\n<h4 id=\"SzrB4\">3.7 \u5e94\u7528\u573a\u666f<\/h4>\n<p id=\"u7e2d401a\">BFS\u4e13\u6ce8\u4e8e\u201c\u6700\u77ed\u8def\u5f84\u201d&#xff08;\u65e0\u6743\u56fe&#xff09;&#xff0c;\u5c42\u5c42\u63a8\u8fdb\u7684\u7279\u6027\u4f7f\u5176\u9002\u5408\u591a\u6e90\u904d\u5386&#xff0c;\u5178\u578b\u5e94\u7528&#xff1a;<\/p>\n<ul>\n<li id=\"u2987eca4\">\u6c42\u89e3\u65e0\u6743\u56fe\u7684\u6700\u77ed\u8def\u5f84&#xff08;\u5982\u8ff7\u5bab\u7684\u6700\u77ed\u8d70\u51fa\u8def\u7ebf\u3001\u793e\u4ea4\u7f51\u7edc\u7684\u4e00\u5ea6\/\u4e8c\u5ea6\u597d\u53cb&#xff09;&#xff1b;<\/li>\n<li id=\"ueab6bbdd\">\u793e\u4ea4\u7f51\u7edc\u7684\u597d\u53cb\u63a8\u8350&#xff08;\u4e00\u5ea6\u597d\u53cb\u3001\u4e8c\u5ea6\u597d\u53cb\u67e5\u627e&#xff0c;\u5c42\u5c42\u63a8\u8fdb&#xff09;&#xff1b;<\/li>\n<li id=\"u68f2ded9\">\u591a\u6e90BFS&#xff08;\u5982\u6d2a\u6c34\u586b\u5145\u3001\u5730\u56fe\u4e0a\u7684\u591a\u8d77\u70b9\u8def\u5f84\u89c4\u5212&#xff09;&#xff1b;<\/li>\n<li id=\"ue5996623\">\u53cc\u7aefBFS&#xff08;\u4ece\u8d77\u70b9\u548c\u7ec8\u70b9\u540c\u65f6BFS&#xff0c;\u5927\u5e45\u63d0\u5347\u957f\u8def\u5f84\u641c\u7d22\u6548\u7387&#xff09;&#xff1b;<\/li>\n<li id=\"u2aad4a72\">\u56fe\u7684\u8fde\u901a\u6027\u5224\u65ad\u3001\u5c42\u5e8f\u904d\u5386&#xff08;\u5982\u4e8c\u53c9\u6811\u7684\u5c42\u5e8f\u904d\u5386\u662f\u7279\u6b8a\u7684BFS&#xff09;\u3002<\/li>\n<\/ul>\n<h3 id=\"VvdnW\">\u56db\u3001DFS\u4e0eBFS\u5bf9\u6bd4<\/h3>\n<p id=\"ube4dd24e\">\u4ece\u601d\u60f3\u3001\u8f85\u52a9\u7ed3\u6784\u3001\u8bbf\u95ee\u987a\u5e8f\u3001\u9002\u7528\u573a\u666f\u7b498\u4e2a\u7ef4\u5ea6\u505a\u5168\u9762\u5bf9\u6bd4&#xff0c;\u662f\u5b9e\u9645\u5f00\u53d1\u4e2d\u9009\u62e9\u904d\u5386\u7b97\u6cd5\u7684\u5173\u952e\u4f9d\u636e&#xff1a;<\/p>\n<table id=\"tqoQQ\">\n<tbody>\n<tr>\n<td>\n<p id=\"u997e7c44\">\u5bf9\u6bd4\u7ef4\u5ea6<\/p>\n<\/td>\n<td>\n<p id=\"u365ef715\">\u6df1\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;DFS&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"uc30db264\">\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22&#xff08;BFS&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uaa0e0f99\">\u601d\u60f3<\/p>\n<\/td>\n<td>\n<p id=\"u3a5505e8\">\u6df1\u5ea6\u4f18\u5148&#xff0c;\u4e00\u6761\u8def\u8d70\u5230\u9ed1&#xff0c;\u9047\u963b\u56de\u6eaf<\/p>\n<\/td>\n<td>\n<p id=\"u7f669355\">\u5e7f\u5ea6\u4f18\u5148&#xff0c;\u5730\u6bef\u5f0f\u5c42\u5c42\u63a8\u8fdb&#xff0c;\u9010\u5c42\u904d\u5386<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ub16cd8ca\">\u8f85\u52a9\u7ed3\u6784<\/p>\n<\/td>\n<td>\n<p id=\"ub509e39d\">\u6808&#xff08;\u9012\u5f52&#xff1a;\u9690\u5f0f\u65b9\u6cd5\u6808&#xff1b;\u975e\u9012\u5f52&#xff1a;\u663e\u5f0f\u6808&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"u6a5c59c0\">\u961f\u5217&#xff08;LinkedList&#xff0c;\u663e\u5f0f\u5b9e\u73b0&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ubd0d3ec0\">\u8bbf\u95ee\u987a\u5e8f<\/p>\n<\/td>\n<td>\n<p id=\"ue3d613d0\">\u5148\u6df1\u540e\u5e7f&#xff0c;\u4e0d\u6309\u8ddd\u79bb\u6392\u5e8f<\/p>\n<\/td>\n<td>\n<p id=\"u6a5b1cf4\">\u5148\u5e7f\u540e\u6df1&#xff0c;\u6309\u5230\u8d77\u70b9\u7684\u8ddd\u79bb&#xff08;\u8fb9\u6570&#xff09;\u6392\u5e8f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ua91b6bee\">\u7279\u6027<\/p>\n<\/td>\n<td>\n<p id=\"u10212ad7\">\u4e0d\u4fdd\u8bc1\u6700\u77ed\u8def\u5f84&#xff0c;\u9002\u5408\u8fde\u901a\u6027\u5224\u65ad<\/p>\n<\/td>\n<td>\n<p id=\"u8ecd0e4d\">\u4fdd\u8bc1\u65e0\u6743\u56fe\u7684\u6700\u77ed\u8def\u5f84&#xff0c;\u9002\u5408\u8def\u5f84\u6c42\u89e3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ubbcaca2c\">\u7a7a\u95f4\u590d\u6742\u5ea6<\/p>\n<\/td>\n<td>\n<p id=\"u1d375219\">\u6700\u574f<\/p>\n<p id=\"u1d375219\">&#xff08;\u6808\u5b58\u50a8\u9876\u70b9&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"u4a21f977\">\u6700\u574f<\/p>\n<p id=\"u4a21f977\">&#xff08;\u961f\u5217\u5b58\u50a8\u9876\u70b9&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ub7bb735c\">\u65f6\u95f4\u590d\u6742\u5ea6<\/p>\n<\/td>\n<td>\n<p id=\"u72ee2579\">\u90bb\u63a5\u8868<\/p>\n<p id=\"u72ee2579\">&#xff0c;\u90bb\u63a5\u77e9\u9635<\/p>\n<\/td>\n<td>\n<p id=\"u20461e27\">\u4e0eDFS\u5b8c\u5168\u4e00\u81f4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u1f438c03\">\u5b9e\u73b0\u65b9\u5f0f<\/p>\n<\/td>\n<td>\n<p id=\"u313e99c1\">\u9012\u5f52&#xff08;\u7b80\u6d01&#xff09;\u3001\u975e\u9012\u5f52&#xff08;\u901a\u7528&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"u4d0ebac6\">\u4ec5\u663e\u5f0f\u961f\u5217\u5b9e\u73b0&#xff08;\u65e0\u9012\u5f52&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ub4da41aa\">\u5178\u578b\u5e94\u7528<\/p>\n<\/td>\n<td>\n<p id=\"u16fed497\">\u8fde\u901a\u6027\u5224\u65ad\u3001\u627e\u73af\u3001\u62d3\u6251\u6392\u5e8f\u3001\u8ff7\u5bab\u63a2\u7d22<\/p>\n<\/td>\n<td>\n<p id=\"u8844efe6\">\u65e0\u6743\u56fe\u6700\u77ed\u8def\u5f84\u3001\u597d\u53cb\u63a8\u8350\u3001\u53cc\u7aefBFS\u3001\u6d2a\u6c34\u586b\u5145<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"vwk4G\">\u4e94\u3001\u6ce8\u610f\u4e8b\u9879<\/h3>\n<li id=\"u78d51a96\">\u8bbf\u95ee\u6807\u8bb0\u662f\u5fc5\u987b\u7684&#xff1a;\u56fe\u5b58\u5728\u73af&#xff0c;\u5fc5\u987b\u7528visited\u6570\u7ec4\/\u96c6\u5408\u6807\u8bb0\u5df2\u8bbf\u95ee\u9876\u70b9&#xff0c;\u5426\u5219\u4f1a\u9677\u5165\u65e0\u9650\u5faa\u73af&#xff1b;<\/li>\n<li id=\"uf85370e6\">\u975e\u8fde\u901a\u56fe\u7684\u904d\u5386&#xff1a;\u4e0a\u8ff0\u4ee3\u7801\u5747\u57fa\u4e8e\u8fde\u901a\u56fe&#xff0c;\u82e5\u56fe\u4e3a\u975e\u8fde\u901a\u56fe&#xff0c;\u9700\u904d\u5386\u6240\u6709\u9876\u70b9&#xff0c;\u5bf9\u672a\u6807\u8bb0\u7684\u9876\u70b9\u91cd\u65b0\u6267\u884cDFS\/BFS&#xff1b;<\/li>\n<li id=\"u1e8bd7e3\">\u90bb\u63a5\u9876\u70b9\u7684\u8bbf\u95ee\u987a\u5e8f&#xff1a;\u904d\u5386\u7ed3\u679c\u4e0d\u552f\u4e00&#xff0c;\u4f9d\u8d56\u90bb\u63a5\u9876\u70b9\u7684\u8bbf\u95ee\u987a\u5e8f&#xff08;\u5982\u5b57\u6bcd\u5e8f\u3001\u63d2\u5165\u5e8f&#xff09;&#xff0c;\u53ef\u901a\u8fc7\u6392\u5e8f\u4fdd\u8bc1\u987a\u5e8f\u4e00\u81f4&#xff1b;<\/li>\n<li id=\"u2fce2e05\">\u6709\u5411\u56fe\u4e0e\u65e0\u5411\u56fe\u7684\u9002\u914d&#xff1a;\u65e0\u5411\u56fe\u7684\u8fb9\u662f\u53cc\u5411\u7684&#xff0c;\u63d2\u5165\u8fb9\u65f6\u9700\u540c\u65f6\u63d2\u5165u\u2192v\u548cv\u2192u&#xff0c;\u5426\u5219\u4f1a\u51fa\u73b0\u904d\u5386\u4e0d\u5b8c\u6574&#xff1b;<\/li>\n<li id=\"uc0500060\">\u6808\u6ea2\u51fa\u95ee\u9898&#xff1a;\u9012\u5f52\u7248DFS\u9002\u5408\u5c0f\u89c4\u6a21\u56fe&#xff0c;\u5927\u89c4\u6a21\u56fe\u9700\u7528\u975e\u9012\u5f52\u7248DFS&#xff08;\u663e\u5f0f\u6808&#xff09;&#xff0c;\u907f\u514dJVM\u65b9\u6cd5\u6808\u6ea2\u51fa&#xff1b;<\/li>\n<li id=\"ub94850d9\">\u6700\u77ed\u8def\u5f84\u7684\u9002\u7528\u8303\u56f4&#xff1a;BFS\u4ec5\u80fd\u6c42\u89e3\u65e0\u6743\u56fe\u7684\u6700\u77ed\u8def\u5f84&#xff0c;\u5e26\u6743\u56fe\u7684\u6700\u77ed\u8def\u5f84\u9700\u7528Dijkstra\u3001Floyd\u7b49\u7b97\u6cd5\u3002<\/li>\n<h3 id=\"GtDtx\">\u516d\u3001\u603b\u7ed3<\/h3>\n<li id=\"ucb0c942a\">\u56fe\u7684\u904d\u5386\u8981\u6c42\u8bbf\u95ee\u6240\u6709\u9876\u70b9\u4e14\u4ec5\u8bbf\u95ee\u4e00\u6b21&#xff0c;\u56e0\u56fe\u6709\u73af\u548c\u591a\u5bf9\u591a\u8fde\u63a5&#xff0c;\u8bbf\u95ee\u6807\u8bb0\u662f\u5b9e\u73b0\u7684\u5173\u952e&#xff0c;\u5206\u4e3aDFS\u548cBFS\u4e24\u79cd\u7b56\u7565&#xff1b;<\/li>\n<li id=\"u537b04b1\">DFS\u57fa\u4e8e\u6808\u5b9e\u73b0&#xff0c;\u662f\u201c\u6df1\u5ea6\u4f18\u5148\u3001\u56de\u6eaf\u63a2\u7d22\u201d&#xff0c;\u9002\u5408\u5224\u65ad\u8fde\u901a\u6027&#xff0c;\u4e0d\u4fdd\u8bc1\u6700\u77ed\u8def\u5f84&#xff0c;\u6709\u9012\u5f52&#xff08;\u7b80\u6d01&#xff09;\u548c\u975e\u9012\u5f52&#xff08;\u901a\u7528&#xff09;\u4e24\u79cd\u5b9e\u73b0&#xff1b;<\/li>\n<li id=\"ub08f28a7\">BFS\u57fa\u4e8e\u961f\u5217\u5b9e\u73b0&#xff0c;\u662f\u201c\u5730\u6bef\u5f0f\u5c42\u5c42\u63a8\u8fdb\u201d&#xff0c;\u662f\u65e0\u6743\u56fe\u6700\u77ed\u8def\u5f84\u7684\u6700\u4f18\u89e3&#xff0c;\u5178\u578b\u5e94\u7528\u4e3a\u793e\u4ea4\u7f51\u7edc\u597d\u53cb\u67e5\u627e\u3001\u8ff7\u5bab\u6700\u77ed\u8def\u5f84&#xff1b;<\/li>\n<li id=\"u34b885ee\">DFS\u548cBFS\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e00\u81f4&#xff1a;\u90bb\u63a5\u8868\u5b58\u50a8&#xff0c;\u90bb\u63a5\u77e9\u9635\u5b58\u50a8&#xff0c;\u7a7a\u95f4\u590d\u6742\u5ea6\u5747\u4e3a\u6700\u574f&#xff1b;<\/li>\n<li id=\"ua09238da\">\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u9009\u62e9\u7b97\u6cd5&#xff1a;\u5224\u65ad\u662f\u5426\u5b58\u5728\u8def\u5f84\u7528DFS&#xff0c;\u6c42\u89e3\u65e0\u6743\u56fe\u6700\u77ed\u8def\u5f84\u7528BFS&#xff1b;<\/li>\n<li id=\"ue46ddffb\">\u975e\u8fde\u901a\u56fe\u9700\u904d\u5386\u6240\u6709\u9876\u70b9&#xff0c;\u5bf9\u672a\u6807\u8bb0\u9876\u70b9\u91cd\u65b0\u6267\u884c\u904d\u5386&#xff1b;\u65e0\u5411\u56fe\u63d2\u5165\u8fb9\u65f6\u9700\u53cc\u5411\u63d2\u5165&#xff0c;\u4fdd\u8bc1\u904d\u5386\u5b8c\u6574\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u66f4\u52a0\u5b8c\u6574\u8be6\u7ec6\u5185\u5bb9\u53ef\u67e5\u770b\u3010\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0\u3011\u548c\u3010\u514d\u8d39\u7248Java\u9762\u8bd5\u9898\u3011\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8<br \/>\n\u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;20w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto<br \/>\n\u5b8c\u6574\u7248Java\u5b66\u4e60\u7b14\u8bb0200w\u5b57&#xff0c;\u9644\u6709\u4ee3\u7801\u5b9e\u73b0&#xff0c;\u56fe\u89e3\u6e05\u695a<\/p>\n","protected":false},"author":2,"featured_media":78003,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5067,427],"topic":[],"class_list":["post-78023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-5067","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/78023.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u66f4\u52a0\u5b8c\u6574\u8be6\u7ec6\u5185\u5bb9\u53ef\u67e5\u770b\u3010\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0\u3011\u548c\u3010\u514d\u8d39\u7248Java\u9762\u8bd5\u9898\u3011\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;20w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248Java\u5b66\u4e60\u7b14\u8bb0200w\u5b57&#xff0c;\u9644\u6709\u4ee3\u7801\u5b9e\u73b0&#xff0c;\u56fe\u89e3\u6e05\u695a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/78023.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-25T14:09:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140937-699f02a15c13f.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78023.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/78023.html\",\"name\":\"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-25T14:09:44+00:00\",\"dateModified\":\"2026-02-25T14:09:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/78023.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/78023.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78023.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/78023.html","og_locale":"zh_CN","og_type":"article","og_title":"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u66f4\u52a0\u5b8c\u6574\u8be6\u7ec6\u5185\u5bb9\u53ef\u67e5\u770b\u3010\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0\u3011\u548c\u3010\u514d\u8d39\u7248Java\u9762\u8bd5\u9898\u3011\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;20w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248Java\u5b66\u4e60\u7b14\u8bb0200w\u5b57&#xff0c;\u9644\u6709\u4ee3\u7801\u5b9e\u73b0&#xff0c;\u56fe\u89e3\u6e05\u695a","og_url":"https:\/\/www.wsisp.com\/helps\/78023.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-25T14:09:44+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225140937-699f02a15c13f.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/78023.html","url":"https:\/\/www.wsisp.com\/helps\/78023.html","name":"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-25T14:09:44+00:00","dateModified":"2026-02-25T14:09:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/78023.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/78023.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/78023.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u56fe\u7684\u904d\u5386\uff08DFS+BFS\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/78023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=78023"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/78023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/78003"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=78023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=78023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=78023"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=78023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}