/******************************************************************** Author: Dana Vrajitoru, IUSB, CS Class: B424 B524 Parallel Programming File name: graph.cc Last updated: October, 2020. Description: Implementation of a class defining a directed graph. *********************************************************************/ #include "graph.h" #include #include #include #include // Default constructor - makes an empty undirected graph. Graph::Graph() { nr_vertices = 0; nr_edges = 0; } // Destructor - empty the lists and the vector. Graph::~Graph() { Make_empty(); } // Starts the graph over. void Graph::Make_empty() { if (nr_vertices) { for (int i=0; i> nrv; Init(nrv); while (fin.good() && !fin.eof()) { fin >> v1 >> v2; if (fin.good()) Add_edge(v1, v2); } fin.close(); } // Simple print of the graph. void Graph::Print() { int i, j; cout << "The graph contains " << nr_vertices << " vertices and " << nr_edges << " edges" << endl; if (nr_vertices) { cout << "The outgoing edges for each vertex are:" << endl; for (i=0; i 0) MPI_Send(outgoing[i], nr_outgoing[i], MPI_INT, i, tag, MPI_COMM_WORLD); } else MPI_Send(&tag, 1, MPI_INT, i, tag, MPI_COMM_WORLD); } // Sends to each slave process first the number of incoming vertices, // then the array of vertices. void Graph::Send_incoming(int nr_proc) { // To be completed by the student }