Question: Write a pthread program to determine the vertex or vertices with the maximum degree. Your program should use concurrency to sum each row of the
Write a pthread program to determine the vertex or vertices with the maximum degree. Your program should use concurrency to sum each row of the given adjacency matrix, and then calculate the degree for each vertex. Find the vertex or vertices with the maximum. You should only use concurrency to find the degrees of each of the vertices. The rest should of the program should be done sequentially
Input:
From the command line the user will provide file (named: graph.txt ). This file will contain the number of vertices in the graph followed by the upper triangle of the adjacency matrix.
For example:
./a.out graph.txt
In this case, the numbers will be read into from the file graph.txt. Note, since there are k vertices in the graph, the incidence matrix should be at kxk. Hint: you might want to add an extra column to store the
degree of each vertex.
Example contents of graph.txt
7
1 0 1 0 1 0 1
1 1 0 0 1 0
0 1 1 1 0
0 1 1 0
0 1 0
0 1
1
Output: To the console (cout)
Simply, the output on each line the degree of each vertex, and then output the vertex or vertices of maximum degree.
d(0) =
Name your program 0.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
