
URGENT!!! PLS HELP
{
int source, // DON'T EDIT THIS LINE
destination, // DON'T EDIT THIS LINE
weight; // DON'T EDIT THIS LINE
}EDGE; // DON'T EDIT THIS LINE
typedef struct{
int num_vertices, // DON'T EDIT THIS LINE
num_edges; // DON'T EDIT THIS LINE
EDGE *edges; // DON'T EDIT THIS LINE
}GRAPH; // DON'T EDIT THIS LINE
GRAPH *init_graph(int vertices, int edges); // DON'T EDIT THIS LINE
void fill_graph(GRAPH *graph); // DON'T EDIT THIS LINE
int is_cycle(/*DON'T FORGET TO EDIT THIS LINE*/);
void Kruskals_MST(GRAPH *graph); // DON'T EDIT THIS LINE
int main() {
GRAPH *graph = init_graph(10, 14); // DON'T EDIT THIS LINE
fill_graph(graph); // DON'T EDIT THIS LINE
Kruskals_MST(graph); // DON'T EDIT THIS LINE
return 0;
}
GRAPH *init_graph(int vertices, int edges) {
GRAPH *graph = calloc(1, sizeof(*graph)); // DON'T EDIT THIS LINE
if(graph == NULL) { // DON'T EDIT THIS LINE
printf("Error:"); // DON'T EDIT THIS LINE
exit(EXIT_FAILURE); // DON'T EDIT THIS LINE
}
graph->num_vertices = vertices; // DON'T EDIT THIS LINE
graph->num_edges = edges; // DON'T EDIT THIS LINE
graph->edges = calloc(edges, sizeof(EDGE));// DON'T EDIT THIS LINE
if(graph->edges == NULL){ // DON'T EDIT THIS LINE
printf("Error:"); // DON'T EDIT THIS LINE
exit(EXIT_FAILURE); // DON'T EDIT THIS LINE
}
return graph; // DON'T EDIT THIS LINE
}
void fill_graph(GRAPH *graph){
graph->edges[0].source = 1; // DON'T EDIT THIS LINE
graph->edges[0].destination = 3; // DON'T EDIT THIS LINE
graph->edges[0].weight = 12; // DON'T EDIT THIS LINE
graph->edges[1].source = 1; // DON'T EDIT THIS LINE
graph->edges[1].destination = 2; // DON'T EDIT THIS LINE
graph->edges[1].weight = 4; // DON'T EDIT THIS LINE
graph->edges[2].source = 2; // DON'T EDIT THIS LINE
graph->edges[2].destination = 5; // DON'T EDIT THIS LINE
graph->edges[2].weight = 10; // DON'T EDIT THIS LINE
graph->edges[3].source = 3; // DON'T EDIT THIS LINE
graph->edges[3].destination = 5; // DON'T EDIT THIS LINE
graph->edges[3].weight = 2; // DON'T EDIT THIS LINE
graph->edges[4].source = 3; // DON'T EDIT THIS LINE
graph->edges[4].destination = 4; // DON'T EDIT THIS LINE
graph->edges[4].weight = 7; // DON'T EDIT THIS LINE
graph->edges[5].source = 4; // DON'T EDIT THIS LINE
graph->edges[5].destination = 5; // DON'T EDIT THIS LINE
graph->edges[5].weight = 3; // DON'T EDIT THIS LINE
graph->edges[6].source = 4; // DON'T EDIT THIS LINE
graph->edges[6].destination = 6; // DON'T EDIT THIS LINE
graph->edges[6].weight = 8; // DON'T EDIT THIS LINE
graph->edges[7].source = 5; // DON'T EDIT THIS LINE
graph->edges[7].destination = 6; // DON'T EDIT THIS LINE
graph->edges[7].weight = 9; // DON'T EDIT THIS LINE
graph->edges[8].source = 6; // DON'T EDIT THIS LINE
graph->edges[8].destination = 7; // DON'T EDIT THIS LINE
graph->edges[8].weight = 11; // DON'T EDIT THIS LINE
graph->edges[9].source = 6; // DON'T EDIT THIS LINE
graph->edges[9].destination = 8; // DON'T EDIT THIS LINE
graph->edges[9].weight = 1; // DON'T EDIT THIS LINE
graph->edges[10].source = 7; // DON'T EDIT THIS LINE
graph->edges[10].destination = 8; // DON'T EDIT THIS LINE
graph->edges[10].weight = 13; // DON'T EDIT THIS LINE
graph->edges[11].source = 7; // DON'T EDIT THIS LINE
graph->edges[11].destination = 10; // DON'T EDIT THIS LINE
graph->edges[11].weight = 6; // DON'T EDIT THIS LINE
graph->edges[12].source = 8; // DON'T EDIT THIS LINE
graph->edges[12].destination = 9; // DON'T EDIT THIS LINE
graph->edges[12].weight = 5; // DON'T EDIT THIS LINE
graph->edges[13].source = 9; // DON'T EDIT THIS LINE
graph->edges[13].destination = 10; // DON'T EDIT THIS LINE
graph->edges[13].weight = 14; // DON'T EDIT THIS LINE
}
int is_cycle() {
return 0;
}
void Kruskals_MST(GRAPH *graph){


Step by stepSolved in 4 steps

- #include <iostream>#include <cstdlib>using namespace std; class IntNode {public: IntNode(int dataInit = 0, IntNode* nextLoc = nullptr); void InsertAfter(IntNode* nodeLoc); IntNode* GetNext(); void PrintNodeData(); int GetDataVal();private: int dataVal; IntNode* nextNodePtr;}; // ConstructorIntNode::IntNode(int dataInit, IntNode* nextLoc) { this->dataVal = dataInit; this->nextNodePtr = nextLoc;} /* Insert node after this node. * Before: this -- next * After: this -- node -- next */void IntNode::InsertAfter(IntNode* nodeLoc) { IntNode* tmpNext = nullptr; tmpNext = this->nextNodePtr; // Remember next this->nextNodePtr = nodeLoc; // this -- node -- ? nodeLoc->nextNodePtr = tmpNext; // this -- node -- next} // Print dataValvoid IntNode::PrintNodeData() { cout << this->dataVal << endl;} // Grab location pointed by nextNodePtrIntNode* IntNode::GetNext() { return this->nextNodePtr;} int IntNode::GetDataVal() {…arrow_forwardYou may have found it somewhat tedious and unpleasant to use the debugger and visualizer to verify the correctness of your addFirst and addLast methods. There is also the problem that such manual verification becomes stale as soon as you change your code. Imagine that you made some minor but uncertain change to addLast]. To verify that you didn't break anything you'd have to go back and do that whole process again. Yuck. What we really want are some automated tests. But unfortunately there's no easy way to verify correctness of addFirst and addLast] if those are the only two methods we've implemented. That is, there's currently no way to iterate over our list and get bad its values and see that they are correct. That's where the toList method comes in. When called, this method returns a List representation of the Deque. For example, if the Deque has had addLast (5) addLast (9) addLast (10), then addFirst (3) called on it, then the result of toList() should be a List with 3 at the…arrow_forwardMain difference between an array and an ArrayList is that an ArrayList can store more data types an ArrayList can store more elements an ArrayList executes faster for retrieval and insertion an ArrayList takes care of the memory management automatically an ArrayList uses positions and an array uses indicesarrow_forward
- The C++ Vertex class represents a vertex in a graph. The class's only data member is _____ Ⓒlabel 1000 O weight O framEdges O toEdges Question 36 The C++ Graph class's fromEdges member is a(n) _________ O string Ⓒdouble O vector O unordered_map Question 37 The C++ Graph class's AddVertex() function's return type is _____ void O Edge+ Overtex) O vectorarrow_forwardOpenGL Programming Help Write a program that creates a 3d "U" that animates using a display list. In response to the menu selection, 1.spin the "U" vertically 2. stop spinning When the user clicks on the right mouse button and selects the menu option to spin the "U" it should spin in the letter.arrow_forwardUsing the following Triangle structure, declare a structure variable and initialize its vertices to (0,0), (5, 0), and (7,6): Triangle STRUCT Vertex1 COORD Vertex2 COORD Vertex3 COORD Triangle ENDS Declare an array of Triangle structures. Write a loop that initializes Vertex1 of each triangle to random coordinates in the range (0...10, 0...10).arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





