954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

dijkstra algorithm problem in c++

I have problem with dijkstra algorithm
I want to write it in c++ and can not describe it in c++ //
please help me

myleila
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

what is this dijkstra algorith. (i'm sorry if i am less informed about the topic)

johnpeter1989
Newbie Poster
7 posts since Nov 2006
Reputation Points: 11
Solved Threads: 1
 

Here is some pseudocode code

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

how I can use stack and queue to find shortest path ?

myleila
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

>how I can use stack and queue to find shortest path ?

It's called homework for a reason. You can use the stack and queue as defined in the standard template library. Go google.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
I have problem with dijkstra algorithm I want to write it in c++ and can not describe it in c++ // please help me


I will try to code it for you in the following days and i will post it on your thread hopefully.
Begueradj.

begueradj
Junior Poster in Training
70 posts since Mar 2007
Reputation Points: 9
Solved Threads: 0
 
I will try to code it for you in the following days and i will post it on your thread hopefully. Begueradj.


Youdo realize that the question was asked 1,5 years ago right?

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

i did not realize that :(

begueradj
Junior Poster in Training
70 posts since Mar 2007
Reputation Points: 9
Solved Threads: 0
 

shortestPath(in theGraph, in weight:WeightArray) {
// Finds the minimum-cost paths between an origin vertex (vertex 0)
// and all other vertices in a weighted directed graph theGraph;
// theGraph’s weights are nonnegative
Create a set vertexSet that contains only vertex 0;
n = number of vertices in the Graph;
// Step 1
for (v=0 through n-1)
weight[v] = matrix[0][v];
// Steps 2 through n
for (step=2 through n) {
Find the smallest weight[v] such that v is not in vertexSet;
Add v to vertexSet;
for (all vertices u not in vertexSet)
if (weight[u] > weight[v]+matrix[v][u])
weigth[u] = weight[v]+matrix[v][u];
}
}
Algorithm is above if u try to find this algorithm but i think nobody develops a code for u here. Because it seems like it's your homework. right?

omeralper
Newbie Poster
14 posts since Nov 2007
Reputation Points: 10
Solved Threads: 1
 

Thank the gods you finally arrived to give us the answer to this perplexing problem.

and to think we were just getting ready to close this one out as "unsolved"

*whew*

(next time, please dont wait so long, mmmkay?)

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You