Common implementations of GPS navigation systems implement what is referred to as a minimum…

Common implementations of GPS navigation systems implement what is referred to as a minimum spanning tree (an MST). The MST of a graph is the smallest path created that ensures all vertices are visited while simultaneously minimizing the amount of possible edges that are covered (taking care, of course, not to form a cycle). In order to figure out if an MST can even be calculated (which requires that a path be viable between every vertex – in other words, the graph cannot be disconnected), we must first use a depth-first traversal to ensure every vertex is visited (a DFS).

You work at a company that is expanding and thinking of moving some of its employees’ offices around in order to cut down on the commute from one office to another. As the company’s developer, you are tasked with finding the current MST of each team of employees (a team of employees is made up of one manager, with the rest being their subordinates). You must first determine if an MST can be created or not by applying a DFS algorithm on each team. If the DFS algorithm is successful, then find the MST of the employees; afterwards, move a specified employee to a new designated office, and recalculate the MST to see if it is any less than the original MST. If it is less, then the team would benefit from having that employee’s office relocated; otherwise, the employee will stay in their original office. Note that you should use the vector stl library and its functions to complete this program.

Input Example

```2 //Number of teams that will be input
5 //On team 1, there are 5 employees (5 vertices)
0 1 5 //Connects vertex 0 with vertex 1, edge weight = 5. First line, so this is the manager
0 2 3 //Connects vertex 0 with vertex 2, edge weight = 3. Normal employee
1 2 7 //Connects vertex 1 with vertex 2, edge weight = 7. Normal employee
1 3 9 //Connects vertex 1 with vertex 3, edge weight = 9. Normal employee
2 4 3 //Connects vertex 2 with vertex 4, edge weight = 3. Normal employee
4 3 4 //Connects vertex 4 with vertex 3, edge weight = 4. Normal employee
-1 -1 -1 //This line indicates the end of the current team; DO NOT include this in the graph
0 1 4 //The new office’s vertex 0 would connect with vertex 1, edge weight = 4, replacing the previous edge connecting these same two vertices
3 //On team 2, there are 3 employees (3 vertices)
0 1 2 //Connects vertex 0 with vertex 1, edge weight = 2. First line, so this is the manager
0 2 5 //Connects vertex 0 with vertex 2, edge weight = 5. Normal employee
1 2 1 //Connects vertex 1 with vertex 2, edge weight = 1. Normal employee
-1 -1 -1 //This line indicates the end of the current team; DO NOT include this in the graph
0 2 7 //The new office’s vertex 0 would connect with vertex 2, edge weight = 7, replacing the previous edge connecting these same two vertices
```

The program can further be broken down as follows:

Graph.h

• Constructor: Take in the number of vertices from the main input file and construct an empty graph of that size. Utilize the vector matrix private variable in order to do this. Make sure to also set the original values for the visited vector in the constructor as well.
• insertEdge: Insert a specific weight into the vector. Assume the graphs are undirected in order to come out with the correct implementation.
• DFS: Implement a DFS function (can be any algorithm of your choice) in order to traverse the graph. Note that the starting vertex for the DFS function should be the manager’s current desk (the first edge given in the current team).
• edgeCheck: This function should simply check if all of the vertices were visited or not upon calling the DFS function in order to determine whether an MST can be created.
• resetVisited: Implement a helper function that will be called on in main in order to reset your visited array before calculating the MST.
• MST: Implement an MST function (make sure to implement Prim’s algorithm to ensure your output will match with the expected output) in order to find the minimum spanning tree of all employee desks.

main.cpp

• Read in all input using cin. Assume all input is valid and follows the same formatting as above.
• For each team of employees:
• Create a new Graph and call on the insertEdge function in order to add all weights to their correct vertices.
• Call the DFS function on the first vertex of the current set of employees.
• Check if the current team of employees passes the edgeCheck or not.
• If the edgeCheck is not passed:
• Cout the statement “No path is formed from each location to every other”.
• If the edgeCheck is passed:
• Cout the statement “A path is formed!”
• Calculate the original MST of the Graph, and cout with the phrase “Original MST was: “, followed by the original MST.
• Replace the designated employee office with the new one given in the input.
• Recalculate the MST of the Graph, and cout with the phrase “New MST is: “, followed by the new MST.
• Check if the original MST of the Graph is greater than the new one or not. If it is greater, then cout the statement “Employee’s office should be moved”. If it is not, then cout the statement “Employee’s office should NOT be moved”.
• When all teams of employees have been read and processed, output the statement “Number of employees’ offices with invalid paths: ” alongside the ratio of the number of teams that failed the edgeCheck versus the total number of teams.
• Afterwards, output the statement “Number of employees who would benefit from moving offices: “ alongside the ratio of the number of teams whose new MST was found to be smaller than their original MST versus the total number of teams.

Output Example

```A path is formed!
Original MST was: 15
New MST is: 14
Employee's office should be moved
A path is formed!
Original MST was: 3
New MST is: 3
Employee's office should NOT be moved
Number of employees' offices with invalid paths: 0/2
Number of employees who would benefit from moving offices: 1/2```

main.cpp

#include

using namespace std;

int main(int argc, char* argv[]) {
//Implement main function

return 0;
}

graph.h

#pragma once
#include

using namespace std;

class Graph {
private:
vector<>

public:
Graph(int mySize) {
//Implement function
}

void resetVisited() {
//Implement function
}

void insertEdge(int v1, int v2, int weight) {
//Implement function
}

void DFS(int vertex) {
//Implement function
}

bool edgeCheck() {
//Implement function
}

int MST() {
//Implement function
}
};

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:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
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.

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.

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.