Connecting Tech Pros Worldwide Help | Site Map

c++ code for shortest path in the graph

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 26th, 2006, 12:05 AM
Shuch
Guest
 
Posts: n/a
Default c++ code for shortest path in the graph

Hi all,
I am in shortage of time...and i want to know if someone has a code
written in c++ or c for finding the shortest path using stack or
queue??????my specifications r as follow:

Input data:
n = integer number representing the number of vertices
k = small integer number representing the maximal vertex degree
G = unoriented labeled connected graph G with n vertices and maximal
degree k
u,v = a pair of vertices of graph G
s = integer number
p = number of processors ----for the time being its not necessary...

Recommendation for generating G:
Use graph generator Generator1 with type -t 1. It generates unoriented
connected graph. Then the edges must be labeled by random weights from
interval <-255,255>. Make sure that some edges have negative weights,
since if edges have only positives weights, the problem has polynomial
complexity and it is easy to solve.

Task:
Find a path (each vertex must be visited at most once) connecting pair
of vertices u a v such that the sum of edge labels is maximal over all
possible such paths and at the same time, lower than s.

Output of the algorithm:
Information whether such a path exists. If so, then the sequence of
edges of the minimal path with the weights of its edges.

Sequential algorithm:
The sequential algorithm is of type BB-DFS with the search depth
bounded by |V|-1. A possible final state is a path connecting vertices
u and v. The price to be minimized is the total weight of the path. The
lower bound on the path weight is c-1. The algorithm terminates if the
price is equal to the lower bound. Otherwise, the algorithm must
perform exhaustive search. Note that a solution may not exist.

-------------------------------------

PLEASE PLEASE PLEASE PLEASE...its a very humble request if anyone has
any idea regarding this then PLEASE MAIL a copy of it on my mail id as
well....i will b waiting for atleast SOME HELP....
please help me outt :((
regards.


  #2  
Old March 26th, 2006, 08:55 AM
W Marsh
Guest
 
Posts: n/a
Default Re: c++ code for shortest path in the graph

On 25 Mar 2006 16:54:09 -0800, "Shuch" <ShuchiTandon@gmail.com> wrote:
[color=blue]
>Hi all,
> I am in shortage of time...and i want to know if someone has a code
>written in c++ or c for finding the shortest path using stack or
>queue??????my specifications r as follow:[/color]
[color=blue]
>
>PLEASE PLEASE PLEASE PLEASE...its a very humble request if anyone has
>any idea regarding this then PLEASE MAIL a copy of it on my mail id as
>well....i will b waiting for atleast SOME HELP....
>please help me outt :((
>regards.[/color]

Haha! Somebody's going to fail comp science...
  #3  
Old March 26th, 2006, 09:55 AM
Shuch
Guest
 
Posts: n/a
Default Re: c++ code for shortest path in the graph

haha...thats not possible...:)...coz i have some ideas but the problem
is just that i m not able to figure it out how to write it
correctly..thats y i m askin if someone has some code....

  #4  
Old March 26th, 2006, 10:05 AM
W Marsh
Guest
 
Posts: n/a
Default Re: c++ code for shortest path in the graph

On 26 Mar 2006 02:46:21 -0800, "Shuch" <ShuchiTandon@gmail.com> wrote:
[color=blue]
>haha...thats not possible...:)...coz i have some ideas but the problem
>is just that i m not able to figure it out how to write it
>correctly..thats y i m askin if someone has some code....[/color]

Wrong group, though. Find a specific algorithms group or web forum.
This group is for the C++ language itself.

Also, head down to the library.
  #5  
Old March 27th, 2006, 03:15 AM
Jack Klein
Guest
 
Posts: n/a
Default Re: c++ code for shortest path in the graph

On 25 Mar 2006 16:54:09 -0800, "Shuch" <ShuchiTandon@gmail.com> wrote
in comp.lang.c++:
[color=blue]
> Hi all,
> I am in shortage of time...and i want to know if someone has a code
> written in c++ or c for finding the shortest path using stack or
> queue??????my specifications r as follow:[/color]

Send us your instructor's email address and we'll save you even more
time by turning in the homework as well.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.