Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide the complete PYTHON code !!!!! Let's start programming with networks! There are many Python packages for working with networks, but I recommend using
Please provide the complete PYTHON code !!!!!
Let's start programming with networks! There are many Python packages for working with networks, but I recommend using Networkx for now. To get started using Networkx, consider completing this coding tutorial. A few of the following questions are taken from the end of the tutorial. Networkx has several built-in functions for generating Erods-Renyi random networks, Watts-Strogatz small-networks, and many other types of networks. You can learn more about the network generators here. Here is an example using one of the network generators in a Jupyter notebook: (a) Write a function that takes a graph and returns the maximum degree of the nodes in that graph. (b) Write a function that takes as input a graph and two nodes, and outputs a list of nodes that are neighbors to both of the input nodes. (c) Write code to reproduce the figure below. Please submit both your code and the resulting figure. The figure is taken from the original paper by Duncan Watts and Steven Strogatz introducing their network model. Here, L(p) is the average length of the shortest path between every pair of nodes when the network model was run with N=1,000 and k=10 while varying model parameter p. Similarly, C(p) is the average clustering coefficient. Note that Networkx has a built-in generator function for to creating Watts-Strogatz networks called watts_strogatz_model. You can learn more about this function here. Networkx also has built-in functions for calculating average shortest paths and clustering coefficients
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