Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

CUP Dijkstra’s Algorithm Data structures C++ Project

Description

Instructions

For C++ Programming  you will be implementing an undirected weighted Graph ADT and performing Dijkstra’s Algorithm to find the shortest path between two vertices. Your graph can be implemented using either an adjacency list, adjacency matrix, or an incidence matrix. Your graph will implement methods that add and remove vertices, add and remove edges, and calculate the shortest path. Each vertex in your graph will have a string label that will help identify that vertex to you and the test file.

A large portion of this assignment is researching and implementing Dijkstra’s Algorithm. There is information about this algorithm in your textbook and widely available on the web.

Abstract Class Methods

void addVertex(std::string label)

Creates and adds a vertex to the graph with label. No two vertices should have the same label.

void removeVertex(std::string label)

Removes the vertex with label from the graph. Also removes the edges between that vertex and the other vertices of the graph.

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

Adds an edge of value weight to the graph between the vertex with label1 and the vertex with label2. A vertex with label1 and a vertex with label2 must both exist, there must not already be an edge between those vertices, and a vertex cannot have an edge to itself.

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

Removes the edge from the graph between the vertex with label1 and the vertex with label2. A vertex with label1 and a vertex with label2 must both exist and there must be an edge between those vertices

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

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.

Examples

Below in an example of the functionality of the implemented graph:

std::vector<std::string> vertices1 = { “1”, “2”, “3”, “4”, “5”, “6” };

std::vector<std::tuple<std::string, std::string, unsigned long>> edges1 = { {“1”, “2”, 7}, {“1”, “3”, 9}, {“1”, “6”, 14}, {“2”, “3”, 10}, {“2”, “4”, 15}, {“3”, “4”, 11}, {“3”, “6”, 2}, {“4”, “5”, 6}, {“5”, “6”, 9} };

for (const auto label : vertices1) g.addVertex(label);

for (const auto &tuple : edges1) g.addEdge(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple));

g.shortestPath(“1”, “5”, path); // == 20

g.shortestPath(“1”, “5”, path); // = { “1”, “3”, “6”, “5” }

Deliverables

Please submit complete projects as zipped folders. The zipped folder should contain:

  • Graph.cpp (Your written Graph class)
  • Graph.hpp (Your written Graph class)
  • GraphBase.hpp (The provided base class)
  • PP4Test.cpp (Test file)
  • catch.hpp (Catch2 Header)

And any additional source and header files needed for your project.

Hints

Though it may be appealing to use an adjacency matrix, it might be simpler to complete this algorithm using an adjacency list for each vertex.

I suggest using a separate class for your edge and vertex.

Remember to write a destructor for your graphs!

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20