{"id":306,"date":"2011-10-10T14:05:44","date_gmt":"2011-10-10T06:05:44","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=306"},"modified":"2020-06-06T14:06:54","modified_gmt":"2020-06-06T06:06:54","slug":"%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84_%e5%9b%be_%e6%b1%82%e6%97%a0%e5%90%91%e5%9b%be%e7%9a%84%e5%85%b3%e8%8a%82%e7%82%b9","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=306","title":{"rendered":"\u6570\u636e\u7ed3\u6784_\u56fe_\u6c42\u65e0\u5411\u56fe\u7684\u5173\u8282\u70b9"},"content":{"rendered":"\n<p>head.h<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\nusing namespace std;\n\n#define MAX_VEX_NUM 20\n\nclass ChildNode \/\/\u5b58\u50a8\u4ee5\u67d0\u9876\u70b9\u4e3a\u8fb9\u7684\u4e00\u4e2a\u9876\u70b9\u7684\u53e6\u4e00\u4e2a\u9876\u70b9\n{\npublic:\n\tChildNode();\n\tint child;\n\tChildNode *next;\n};\n\nChildNode::ChildNode()\n{\n\tchild = 0;\n\tnext = NULL;\n}\n\nclass VexNode \/\/\u9876\u70b9\u4fe1\u606f\n{\npublic:\n\tVexNode();\n\tchar name;\n\tint visitsq; \/\/\u8bbf\u95ee\u987a\u5e8f\n\tint low; \/\/low\u503c\n\tChildNode *firstchild;\n};\n\nVexNode::VexNode()\n{\n\tvisitsq = low = 0;\n\tfirstchild = NULL;\n}\n\nclass VexBox \/\/\u9876\u70b9\u96c6\u5408\n{\npublic:\n\tVexBox();\n\tint vexnum;\n\tVexNode vexbox&#91;MAX_VEX_NUM];\n};\n\nVexBox::VexBox()\n{\n\tvexnum = 0;\n}\n\nclass ArtPoint \/\/Articulation Point\/\/\u5173\u8282\u70b9\u7c7b\n{\npublic:\n\tvoid GetArtPoint(); \/\/\u63a5\u53e3\u51fd\u6570\nprivate:\n\tvoid GetVexNode(); \/\/\u5f97\u5230\u9876\u70b9\u4fe1\u606f\n\tvoid GetEdge(); \/\/\u5f97\u5230\u8fb9\u7684\u4fe1\u606f\n\tvoid FindArticul(); \/\/\u627e\u5173\u8282\u70b9\n\tvoid DFSArticul(int); \/\/\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u56fe\n\tVexBox v;\n\tint count;\n};\n\nvoid ArtPoint::GetArtPoint() \/\/\u63a5\u53e3\u51fd\u6570\n{\n\tGetVexNode(); \/\/\u5f97\u5230\u9876\u70b9\u4fe1\u606f\n\tGetEdge(); \/\/\u5f97\u5230\u8fb9\u7684\u4fe1\u606f\n\tFindArticul(); \/\/\u627e\u5173\u8282\u70b9\n}\n\nvoid ArtPoint::GetVexNode() \/\/\u5f97\u5230\u9876\u70b9\u4fe1\u606f\n{\n\tcout &lt;&lt; \"Please Input The Name Of The Vertex :\" &lt;&lt; endl &lt;&lt; endl;\n\tchar name;\n\twhile (cin >> name)\n\t{\n\t\tv.vexbox&#91;v.vexnum++].name = name;\n\t}\n\tcin.clear();\n}\n\nvoid ArtPoint::GetEdge() \/\/\u5f97\u5230\u8fb9\u7684\u4fe1\u606f\n{\n\tcout &lt;&lt; \"Please Input The Two Nodes Which Made A Edge :\" &lt;&lt; endl &lt;&lt; endl;\n\tint t&#91;2];\n\tChildNode *p, *newnode;\n\twhile (cin >> t&#91;0] >> t&#91;1])\n\t{\n\t\tfor (int i = 0; i &lt; 2; i++)\n\t\t{\n\t\t\tnewnode = new ChildNode;\n\t\t\tnewnode->child = t&#91;1 - i];\n\t\t\tif ((p = v.vexbox&#91;t&#91;i]].firstchild) == NULL)\n\t\t\t{\n\t\t\t\tv.vexbox&#91;t&#91;i]].firstchild = newnode;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (p->next != NULL)\n\t\t\t\t{\n\t\t\t\t\tp = p->next;\n\t\t\t\t}\n\t\t\t\tp->next = newnode;\n\t\t\t}\n\t\t}\n\t}\n\tcin.clear();\n}\n\nvoid ArtPoint::FindArticul() \/\/\u627e\u5173\u8282\u70b9\n{\n\tcount = 1; \/\/\u521d\u59cb\u5316count\u8bb0\u5f55\u8bbf\u95ee\u6b21\u5e8f\n\tv.vexbox&#91;0].visitsq = 1;\n\tDFSArticul(0); \/\/\u4ece\u7b2c\u4e00\u4e2a\u8282\u70b9\u5f00\u59cb\u8bbf\u95ee\n\tif (count &lt; v.vexnum) \/\/\u5982\u679c\u751f\u6210\u6811\u7684\u6839\u6709\u4e24\u9897\u6216\u4e24\u9897\u4ee5\u4e0a\u5b50\u6811\n\t{\n\t\tcout &lt;&lt; v.vexbox&#91;0].name &lt;&lt; endl; \/\/\u8be5\u8282\u70b9\u4e3a\u5173\u8282\u70b9\u8f93\u51fa\u4e4b\n\t}\n\tfor (int i = 1; i &lt; v.vexnum; i++) \/\/\u8bbf\u95ee\u5269\u4f59\u672a\u88ab\u8bbf\u95ee\u7684\u8282\u70b9\n\t{\n\t\tif (v.vexbox&#91;i].visitsq == 0)\n\t\t{\n\t\t\tDFSArticul(i);\n\t\t}\n\t}\n}\n\nvoid ArtPoint::DFSArticul(int n) \/\/\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u56fe\n{\n\t\/\/\u8be5\u8282\u70b9\u7684low\u503c\u88ab\u5b9a\u4e49\u4e3aMIN{\u5f53\u524d\u8282\u70b9\u7684\u8bbf\u95ee\u6b21\u5e8f\uff0c\u5b69\u5b50\u8282\u70b9\u7684low\u503c\uff0c\u7956\u5148\u8282\u70b9\u7684\u8bbf\u95ee\u6b21\u5e8f}\n\tint min = v.vexbox&#91;n].visitsq = ++count; \/\/\u521d\u59cb\u5316min\n\tChildNode *p = v.vexbox&#91;n].firstchild;\n\twhile (p != NULL) \/\/\u8bbf\u95ee\u4e0e\u8be5\u9876\u70b9\u6709\u8fb9\u76f8\u8fde\u7684\u6240\u6709\u9876\u70b9\n\t{\n\t\tif (v.vexbox&#91;p->child].visitsq == 0) \/\/\u8bbf\u95ee\u7684\u662f\u5b69\u5b50\u8282\u70b9\n\t\t{\n\t\t\tDFSArticul(p->child); \/\/\u4ee5\u8be5\u9876\u70b9\u5f00\u59cb\u6df1\u5ea6\u4f18\u5148\u904d\u5386\u56fe\n\t\t\tif (v.vexbox&#91;p->child].low &lt; min) \/\/\u5982\u679c\u5b69\u5b50\u8282\u70b9\u7684low\u503c\u6709\u5c0f\u4e8emin\u7684\n\t\t\t\tmin = v.vexbox&#91;p->child].low; \/\/\u66f4\u65b0\u5f53\u524d\u8282\u70b9\u7684low\u503c\n\t\t\tif (v.vexbox&#91;p->child].low >= v.vexbox&#91;n].visitsq) \/\/\u5982\u679c\u5b69\u5b50\u8282\u70b9\u7684low\u503c\u5927\u4e8e\u7b49\u4e8e\u5f53\u524d\u8282\u70b9\u7684\u8bbf\u95ee\u6b21\u5e8f\n\t\t\t\t\/\/\u8bf4\u660e\u8be5\u6811\u7684\u6839\u548c\u5b50\u6811\u4e2d\u7684\u5176\u4ed6\u8282\u70b9\u5747\u6ca1\u6709\u6307\u5411\u5f53\u524d\u8282\u70b9\u7684\u7956\u5148\u7684\u8282\u70b9\n\t\t\t\tcout &lt;&lt; v.vexbox&#91;n].name &lt;&lt; endl;\t\t\t\t\/\/\u8be5\u8282\u70b9\u4e3a\u5173\u8282\u70b9\n\t\t}\n\t\telse if (v.vexbox&#91;p->child].visitsq &lt; min)\t\t\/\/\u8bbf\u95ee\u7684\u662f\u7956\u5148\u8282\u70b9\/\/\u5982\u6709\u5fc5\u8981\u66f4\u65b0min\n\t\t\tmin = v.vexbox&#91;p->child].visitsq;\n\t\tp = p->next;\n\t}\t\t\t\t\/\/while\n\tv.vexbox&#91;n].low = min;\t\t\t\t\/\/\u5c06\u83b7\u5f97\u7684\u6700\u5c0f\u7684min\u4f5c\u4e3a\u5f53\u524d\u8282\u70b9\u7684low\u503c\n}\n<\/code><\/pre>\n\n\n\n<p>main.cpp<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include\"head.h\"\n \nint main()\n{\n\tArtPoint p;\n\tp.GetArtPoint();\n\tsystem(\"pause\");\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>head.h main.cpp<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-306","post","type-post","status-publish","format-standard","hentry","category-06-02-"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/306\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}