Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry for my English.

Here is the question:

Graph (V,E).

Definition: Legal's up-path in a graph from s to t is existent if and only if for every Vi, Vi+1 (for each i) fulfill w(Vi)<=w(Vi+1), when w(v) is a weight of the vertex.

We know that there is an algorithm like BFS that solve the problem of finding the shorter path in a Graph. We need to find, by reduction, an algorithm that solve the problem of legal's up-path.

I try to split each vertex, but it didn’t work (for example: for Vi=4, I tried to create 4 Edge, and then activate the BFS, but it didn’t work.

Thank u.

share|cite|improve this question
up vote 1 down vote accepted

Assuming the BFS is for directed graphs, and you start with an undirected graph.

Hint: Try to pick a direction (and in some cases two) for each edge in the undirected graph so that the resulting graph is directed, and on which you can activate BFS.

share|cite|improve this answer
Thank u, but where you deal with the weight of the vertex? – user7734 Mar 3 '11 at 13:22
@Eyal: If I tell you it won't be a hint anymore! – Aryabhata Mar 3 '11 at 13:58
I got it.. Thank u – user7734 Mar 3 '11 at 18:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.