CS7280 assignment2
Copyright By PowCoder代写 加微信 powcoder
import collections
import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from powerlaw import *
# Parse the “blog.txt” into graph
out-degree distribution¶
# Plot the out-degree distribution
fitting without xmax¶
#fit the out-degree distribution without xmax
fitting with xmax¶
#fit the out-degree distribution with xmax = 200
in-degree distribution¶
# Plot the in-degree distribution
fitting without xmax¶
# Fit the in-degree distribution without xmax
fitting with xmax¶
# Fit the in-degree distribution with xmax = 300
# Compute the Pearson correlation coefficient
Based on the result, do you think this network is assortative, disassortative or neutral? write 1-2 sentence(s) to state your conclusion and reasons.
# Plot the average neighbor degree as a function of the node degree k
# Plot the diameters of the LCC and the 100 G(n,p) networks
# Plot the average shortest path length of the LCC and the 100 G(n,p) networks
Use the one-sample t-test to examine if the diameter of the undirected network is significantly different than the diameter of the random networks at a 95% significance level. Perform the same test for the average shortest path length. Answer for each: Are the values significantly different? Are they within the same order of magnitude?
# Plot the clustering coefficient of the LCC and a G(n,p) network in CCDF format
Are the two distributions significantly different?
# Plot the average clustering coefficient as a function of the node degree
What do you observe based on the above visualization?
# Plot the transitivity coefficient of the overall network of the LCC and the 100 G(n,p) networks
Combining the results of Part-3 and Part-4, can we conclude that the undirected LCC of Part-1 network is a small-world network or not? Please provide with your reasons.
Which of the previous triplet types are statistically more common (or less common) in the network of the LCC compared to what we would expense based on chance?
Note that the Transitivity and the Average Clustering Coefficient are two different metrics. They may often be close but there are also some extreme cases in which the two metrics give very different answers. To see that consider a network in which two nodes A and B are connected to each other as well as to every other node. There are no other links. The total number of nodes is n. What would be the transitivity and average clustering coefficient in this case (you can simplify by assuming that n is quite large)? Points will only be awarded for a mathematical derivation, however you may use code to verify your result.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com