DFS和深度树

发布于 2025-01-26 00:24:19 字数 173 浏览 1 评论 0原文

我需要确定以下陈述是对还是错。如果为true,请说明为什么,如果false给出反例。

令T为图G和源顶点s上的DFS算法产生的深度树。 G是一个无向图,其周期为3个顶点。 因此,不包含从G中的S到其他顶点的所有最短途径。

我认为这是真的,但我不知道如何证明它或解释为什么

I need to decide whether the following statement is true or false. If true, explain why, if false give a counterexample.

Let T be the depth-tree resulting from running the DFS algorithm on a graph G and a source vertex s.
G is an undirected graph with a cycle of exactly 3 vertices.
So T necessarily does not contain all the shortest paths from s to the other vertices in G.

I think it's true but I don't know how to prove it or to explain why

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

从﹋此江山别 2025-02-02 00:24:19

这有点棘手,因为图G可能包含其他周期。三个周期可能会嵌入到树上的多种方式,可能是循环中边缘的 nonne 完全在树上,因此很难通过将所有可能的嵌入分为几种情况。

我认为最简单的证明方法是:

  • 如果t是植根于s的g的dfs树,则g中的每个边缘都在t中,或者它将节点连接到t中的祖先
  • 。边缘处于不同的高度。对于树中的边缘,它们会差异1。对于其他边缘,它们至少差异为1。
  • 周期周围的高度变化之和必须为0,因为它以同一顶点启动和结束。
  • 不可能是3周期中的所有高度差异为1,因为这样它们的总数将是一个奇数 - 而不是0。
  • 因此,3个周期中的至少一个边缘必须具有高度差> 1。此边缘将是其下顶点的缩写,因为树上的所有路径都可以每步最多改变高度。

This is a little tricky, because the graph G may contain other cycles. There are many ways that the 3-cycle might be embedded in the tree, and it may be that none of the edges in the cycle are in the tree at all, so it's difficult to make a proof by dividing all the possible embeddings into a few cases.

I think the easiest way to prove this is:

  • If T is a DFS tree for G rooted at s, then every edge in G is either in T, or it connects a node to an ancestor in T.
  • Note that the vertices adjacent to any edge are at different heights. For edges in the tree, they differ by 1. For other edges they differ by at least 1.
  • The sum of height changes around a cycle must be 0, since it starts and ends at the same vertex.
  • It cannot be that all the height differences in the 3-cycle are of magnitude 1, because then their sum would be an odd number -- not 0.
  • At least one edge in the 3-cycle must therefore have a height difference > 1. This edge will be a short-cut to its lower vertex, since all paths in the tree can change height by at most one per step.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文