无向图算法算法

由网友(逆光)分享简介:假设我们有一个n个节点,M-边无向图G =(V,E),我们有两个不同的节点称为s和t。假设s和t之间的距离是严格大于n / 2的较大。表明,是一个节点U是迪?erent从S和T,使得从s每到t的路径经过诉给出一个算法运行时间为O(N + M)为第二这样一个顶点。你不必证明你的算法是正确的,但像V A顶点的存在...

假设我们有一个n个节点,M-边无向图G =(V,E),我们有两个不同的节点 称为s和t。假设s和t之间的距离是严格大于n / 2的较大 。表明, 是一个节点U是迪?erent从S和T,使得从s每到t的路径经过诉 给出一个算法运行时间为O(N + M)为第二这样一个顶点。你不必 证明你的算法是正确的,但像V A顶点的存在,你必须给一个证明。

Suppose that we have an n-node, m-edge undirected graph G = (V; E) and we have two distinct nodes called s and t. Suppose that the distance between s and t is strictly greater than n/2 . Show that there is a node v which is di erent from s and t such that every path from s to t goes through v. Give an algorithm with running time O(n + m) to nd such a vertex. You do not have to prove that your algorithm is correct but you must give a proof that a vertex like v exists.

我想不出来这个过去的纸张问题一个确切的答案,帮助我!

I can not figure out an exact answer to this past paper question, help me out!

推荐答案

假设有s和t之间的两个路径​​,即不共享一个节点。因为s和t之间的距离是> N / 2,比各路径具有s和t之间> = n / 2个节点。这意味着,图中有> = N + 2个节点,什么是一对矛盾。

Suppose there are two paths between s and t, that don't share a node. Since distance between s and t is > n/2, than each path has >= n/2 nodes between s and t. That means that graph has >= n+2 nodes, what is a contradiction.

有关算法就足够了找到任何路径和比看到被连接到一侧(多个),而不使用路径子图节点光洁度。在更多的细节:

For algorithm it is enough to find any path and than see where sub-graph that is connected to one side (s) without using path nodes finish. In more details:

如果s的连接只比我们正在寻找该节点一个节点。 如果不是,从s使BFS 找到路径s-T 找到不使用边缘从路径ST的节点会连接到S-节点 在路径ST最后一个节点即是在连接部分为节点,我们所期待的。
阅读全文

相关推荐

最新文章