Question Please help me fix my code, it causes a seg

Question Please help me fix my code, it causes a segmentation fault and I… Please help me fix my code, it causes a segmentation fault and I don’t know why,implement an undirected weighted Graph ADT and perform 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, andcalculate the shortest path. Each vertex in your graph will have a string label that will helpidentify that vertex to you and the test file.graph.hpp:// Header file#ifndef GRAPH_HPP#define GRAPH_HPP#include “catch.hpp”#include “GraphBase.hpp”#include #include #include #include // Might have to include .hpp files for edge and vertexclass Graph : public GraphBase{ private: std::vector> matrix; std::vector lables; int size_n = 0; protected: // list helper functions used in graph.cpp here void storeDist(int current_node, int dist, int *dist_array); int identify_path(int min_dist, int current_node, std::vector& path, std::string endLabel); public: //constructor Graph() {}; //destructor ~Graph() {}; // main functions in graph – listed in instructions void addVertex(std::string label); void removeVertex(std::string label); void addEdge(std::string label1, std::string label2, unsigned long weight); void removeEdge(std::string label1, std::string label2); unsigned long shortestPath(std::string startLabel, std::string endLabel, std::vector &path);};#endif======================================================================================================graph.cpp:// main graph.cpp file#include “Graph.hpp”//Creates and adds a vertex to the graph with label. No two vertices should have the same label. void Graph::addVertex(std::string label) { //std::cout<< "adding vertex" <> new_matrix(size_n, std::vector(size_n, 0)); //std::cout<< "replacing matrix" <> new_matrix((size_n-1), std::vector((size_n-1), 0)); //std::cout<< "replacing matrix" <index)&&(iindex)) { new_matrix[i-1][j] = matrix[i][j]; } if ((j>index)&&(i>index)) { new_matrix[i-1][j-1] = matrix[i][j]; } if ((j& path){ //std::cout<< "calculating shortest path" < dist) { //update the distance array to store the shorter distance, dist_array[current_node] = dist; //after updating, recursively travel to all of the attached nodes: int i = 0; while(i < size_n) //for each possible attached node { if(matrix[current_node][i] != 0) //if that node is attached { //recursively travel to that node after updating dist storeDist(i,(dist + matrix[current_node][i]),dist_array); } i++; } } return;}//----------------------------------------------int Graph::identify_path(int min_dist, int current_node, std::vector& path, std::string endLabel){ if(min_dist > 0)//while the passed in distance is not zero { int i = 0; while(i < size_n) //for each possible attached node { if(matrix[current_node][i] != 0) //if that node is attached { //add that node to the path vector //then travel to that atttached node, deducting the distance to that node from the passed in value path.push_back(lables[current_node]); //is this correct? i? if (identify_path((min_dist - matrix[current_node][i]), i, path, endLabel)) { //if 1 is returned, you are done so return 1 again return 1; } path.pop_back(); //if 0 is returned the node can not be reached from here via the correct path //so remove the previouslly added node from the path } i++; } //if the loop complets without returning 1, return 0 return 0; } else//once you have reached out the min distance { //if you have arived at the correct node via the correct path, //add the final node to the path and return 1 to inidicate that you are finished if((min_dist == 0) && (lables[current_node] == endLabel)) { path.push_back(lables[current_node]); return 1; } //else return 0 return 0; }}Computer Science Engineering & Technology C++ Programming COP 4530

How it works

  1. Paste your instructions in the instructions box. You can also attach an instructions file
  2. Select the writer category, deadline, education level and review the instructions 
  3. Make a payment for the order to be assignment to a writer
  4.  Download the paper after the writer uploads it 

Will the writer plagiarize my essay?

You will get a plagiarism-free paper and you can get an originality report upon request.

Is this service safe?

All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 20% with the discount code ESSAYHELP