//遍历图上所有节点
Dfs(v) {
if(v是旧点)
return;
将v标记为旧点;
对和V相邻的每个点U {
Dfs(U);
}
}
int main() {
将所有点都标记为新点;
while(在图中能找到新点k)
Dfs(k);
}
遍历图中所有的点
最新推荐文章于 2024-06-08 14:05:29 发布
//遍历图上所有节点
Dfs(v) {
if(v是旧点)
return;
将v标记为旧点;
对和V相邻的每个点U {
Dfs(U);
}
}
int main() {
将所有点都标记为新点;
while(在图中能找到新点k)
Dfs(k);
}