Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|improve this question

1 Answer 1

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|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.