Question: Module 4.1 Guided Assignment 2: Graph Processing Code 2. Graph Processing Code Implement the following methods Compute the degree of a vertex Compute the maximum

Module 4.1 Guided Assignment 2: Graph Processing Code

2. Graph Processing Code

Implement the following methods

  • Compute the degree of a vertex
  • Compute the maximum degree in the graph
  • Compute the minimum degree in the graph
  • Compute the average degree in the graph
  • Count the number of self-loops
  • Count the number of parallel vertices
  • Add a vertex
  • Delete a vertex
  • Delete an edge
  • Check whether the graph contains the edge v-w

Implement TestGraphOperationsclass that will read the description of a graph and print the detailed description (each tested method)

  • Test with tinyG.txt; mediumG.txt; largeG.txt; and random operations for each
  • Start by printing the graph (if the number of verticesis less than 20)
  • Apply all the counting operations on each graph
  • For each graph add 10 vertices, print the graphif the number of verticesis less than 30and then delete the 10 verticesin the order they were added
  • For each graph add 10random edges, print the graphif the number of verticesis less than 30,and then delete the 10edgesin the order they were added
  • For each graph test if they contain 10 randomly generated edges. Print the results.
  • Data source:
  • https://algs4.cs.princeton.edu/41graph/tinyG.txt
  • https://algs4.cs.princeton.edu/41graph/mediumG.txt
  • https://algs4.cs.princeton.edu/41graph/largeG.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!