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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started