<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=10-%E6%90%9C%E7%B4%A2%2F03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2</id>
	<title>10-搜索/03-简单图上搜索 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=10-%E6%90%9C%E7%B4%A2%2F03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2"/>
	<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;action=history"/>
	<updated>2026-05-20T22:29:37Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=438&amp;oldid=prev</id>
		<title>33DAI：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=438&amp;oldid=prev"/>
		<updated>2026-05-20T18:24:05Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 18:24的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l90&quot;&gt;第90行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第90行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:搜索]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:搜索]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:三三文档]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:三三文档]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-407:rev-438:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=407&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=407&amp;oldid=prev"/>
		<updated>2026-05-20T18:12:21Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 18:12的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-406:rev-407 --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=406&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=10-%E6%90%9C%E7%B4%A2/03-%E7%AE%80%E5%8D%95%E5%9B%BE%E4%B8%8A%E6%90%9C%E7%B4%A2&amp;diff=406&amp;oldid=prev"/>
		<updated>2026-05-20T16:50:33Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== 简单图上搜索 ==&lt;br /&gt;
&lt;br /&gt;
在图（Graph）上进行 DFS/BFS，用于遍历连通分量、检测环、求拓扑序等。&lt;br /&gt;
&lt;br /&gt;
=== 图的存储 ===&lt;br /&gt;
&lt;br /&gt;
详见 [[11-图论/01-图论基础|图论基础]]。&lt;br /&gt;
&lt;br /&gt;
=== 图上 DFS ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
vector&amp;lt;int&amp;gt; g[MAXN];&lt;br /&gt;
bool vis[MAXN];&lt;br /&gt;
&lt;br /&gt;
void dfs(int u)&lt;br /&gt;
{&lt;br /&gt;
    vis[u] = true;&lt;br /&gt;
    cout &amp;lt;&amp;lt; u &amp;lt;&amp;lt; &amp;quot; &amp;quot;; // 访问节点&lt;br /&gt;
    for (int v : g[u])&lt;br /&gt;
        if (!vis[v])&lt;br /&gt;
            dfs(v);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 图上 BFS ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void bfs(int start)&lt;br /&gt;
{&lt;br /&gt;
    queue&amp;lt;int&amp;gt; q;&lt;br /&gt;
    q.push(start);&lt;br /&gt;
    vis[start] = true;&lt;br /&gt;
&lt;br /&gt;
    while (!q.empty())&lt;br /&gt;
    {&lt;br /&gt;
        int u = q.front();&lt;br /&gt;
        q.pop();&lt;br /&gt;
        cout &amp;lt;&amp;lt; u &amp;lt;&amp;lt; &amp;quot; &amp;quot;; // 访问节点&lt;br /&gt;
&lt;br /&gt;
        for (int v : g[u])&lt;br /&gt;
            if (!vis[v])&lt;br /&gt;
            {&lt;br /&gt;
                vis[v] = true;&lt;br /&gt;
                q.push(v);&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 连通分量计数 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
int cnt = 0;&lt;br /&gt;
for (int i = 1; i &amp;lt;= n; i++)&lt;br /&gt;
    if (!vis[i])&lt;br /&gt;
    {&lt;br /&gt;
        cnt++;&lt;br /&gt;
        dfs(i); // 或 bfs(i)&lt;br /&gt;
    }&lt;br /&gt;
cout &amp;lt;&amp;lt; cnt &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 检测环 ===&lt;br /&gt;
&lt;br /&gt;
在 DFS 中记录当前路径上的节点：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool on_path[MAXN]; // 当前 DFS 路径上的节点&lt;br /&gt;
&lt;br /&gt;
bool has_cycle(int u)&lt;br /&gt;
{&lt;br /&gt;
    vis[u] = true;&lt;br /&gt;
    on_path[u] = true;&lt;br /&gt;
    for (int v : g[u])&lt;br /&gt;
    {&lt;br /&gt;
        if (!vis[v])&lt;br /&gt;
        {&lt;br /&gt;
            if (has_cycle(v))&lt;br /&gt;
                return true;&lt;br /&gt;
        }&lt;br /&gt;
        else if (on_path[v]) // 当前路径上的节点，说明有环&lt;br /&gt;
            return true;&lt;br /&gt;
    }&lt;br /&gt;
    on_path[u] = false;&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:搜索]]&lt;br /&gt;
[[Category:三三文档]]&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
</feed>