•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 392,076 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,053 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 3796 | Replies: 9
![]() |
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,562
Reputation:
Rep Power: 36
Solved Threads: 860
Here is some pseudocode code
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,578
Reputation:
Rep Power: 8
Solved Threads: 159
•
•
Join Date: Nov 2007
Posts: 4
Reputation:
Rep Power: 0
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?
// 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?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
- Dijkstra Algorithm (Computer Science and Software Design)
- algorithm problem with recursion (Java)
- Dijkstra algorithm (Networking Hardware Configuration)
- Algorithm problem (Computer Science and Software Design)
Other Threads in the C++ Forum
- Previous Thread: Pointer Conversion Problem
- Next Thread: Problem with searching and Edit



Linear Mode