How to Solve the Winnie the Pooh Graph Problem?

  • Thread starter Thread starter Qch
  • Start date Start date
  • Tags Tags
    Graph
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
Qch
Messages
2
Reaction score
0
Hello,

I really need help solving the following problem. I only begin to get familiar with graphs and might have missed something, but I do not know how to solve this. Ok here goes, and sorry for my English in advance.

There is undirected, unweighted graph G = (V, E). Every edge in this graph is road segment, every vertex - crossroad.

Pooh lives in vertex "A" and Tigra in vertex "n - 1", where "n" is total number of vertexes. Winnie goes to his neighbor every week, but forgets to take his honey pot with him. That is why he decided that he will hide his honey pots near the road segments in a tree. But he is so f** lazy, that he wants to hide them in limited places.

The task is to implement the most effective algorithm, which will be able to find smallest possible edges set, at which Pooh will be able to hide his honey pots, that guarantee, that each path from vertex A to vertex B contains at least one of the edges.

So, in other words, whichever road Pooh would take he must be able to seat and eat his honey at least once.

What is already done:

I have already wrote an algorithm to find ALL paths from Pooh's home till Tigra's home. And now I'm stuck.

I know that:

1. if vertex A has more edges than last vertex - we burry honey pots near Tigra's house.
2. if vertex A has less edges than last vertex - we burry honey pots near Pooh's house.
3. I do not know what to do next.

So, if we have the following graph:

(1, 3), (3, 2), (3, 4), (2, 5), (2, 5)

and Pooh lives in 1 and Tigra in 5 than we burry a pot at (1, 3), because this road definitely will be taken (rule #1 works).

Assume that Pooh lives in 5 and Rigra in 1, than rule #2 applies.

But, what if we have the following graph, where we have the same number of edges from Tigra's and Pooh's house?

May be above algorithm is not right at all.

Any ideas?

Thank you in advance.
 
Physics news on Phys.org
You know what... :) as it always happens I wrote and asked for help and figured out a solution. I will code it and then post it here, just in case.

But, if you have your own, I will be glad to hear them.

Thank you.