Question: This question involves using networkx to solve the problem. Using the list rand_move, append the number of connected components after removing each of the 150
This question involves using networkx to solve the problem.
Using the list rand_move, append the number of connected components after removing each of the 150 randomly chosen nodes.
Please use the function random.choice 150 times to select each node (instead of using it just once to select all 150 nodes).
GIVEN CODE BELOW
random.seed(0) # use a fixed random seed for autograder G1 = copy.deepcopy(G) # operate on a copy of the original graph, because node removal is irreversible rand_move = [nx.number_connected_components(G1)] # initialize the list of number of connected components
YOUR CODE HERE:
# YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
