Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Dijkstra's stupid question I am getting stuck with my code in 1 last function: unsigned long shortestPath(std::string startLabel, std::string endLabel, std::vector &path) This function

c++ Dijkstra's stupid question

I am getting stuck with my code in 1 last function:

unsigned long shortestPath(std::string startLabel, std::string endLabel, std::vector &path)

This function calculates the shortest distance from startLabel to endLabel. startLabel and endLabel are something like "USA" or "CAN" or "RUS" . Calculates the shortest path between the vertex with startLabel and the vertex with endLabel using Dijkstra's Algorithm. A vector is passed into the method that stores the shortest path between the vertices. The return value is the sum of the edges between the start and end vertices on the shortest path.

Please dont ask me to provide more information. My project has 5 functions, I have finished 4 of them which are:

void graph::addVertex(std::string label)

void graph::removeVertex(std::string label)

void graph::addEdge(std::string label1, std::string label2, unsigned long weight)

void removeEdge(std::string label1, std::string label2)

and

unsigned long shortestPath(std::string startLabel, std::string endLabel, std::vector &path)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions