Very urgent Help needed..Regarding Pseudo code for graph related work - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Very urgent Help needed..Regarding Pseudo code for graph related work

jano_manojano_mano Posts: 1Member
Hi everyone!

I would appreciate if I can be given some help to solve thus riddle (my project task) to find out the solution. I really need the pseudo code for this which fully solve this problem. I am really dying to solve this problem as I have been working for last two months to solve this but can't get the answer to this.

Assuming you have a graph G whose edges are labeled with the distance between each pair of vertices they connect. Given two vertices a and b in G, and a distance n as input, write an algorithm in pseudo-code to find out if there is a path from a to b with cumulative distance less than n.

I will be very much thankful for any help in this regards

Thanks in advance


  • Malcolm_McLeanMalcolm_McLean Posts: 254Member ✭✭
    Start at A. Label A with 0A. Go to B, label B with 0B. Keep a list of current labels in A and labels in B.

    Go to the A labels. Visit each neighbour and label distance from A, A, and preceding node in the path to A. Go to the B labels and do the same. If the neighbour is already labelled with the other tag, sum the distances. If they are below N, there's your answer.

    Terminate paths when distances go above N, or when you hit an already labelled node with a distance less than your distance.

    Read my books
    [link=] MiniBasic how to write a script interpreter [/link]
    [link=] Basic Algorithms (in C) [/link]
Sign In or Register to comment.