Assignment_5
Copyright By PowCoder代写 加微信 powcoder
import random
import itertools
import networkx as nx
import numpy as np
import community
import matplotlib.pyplot as plt
## Part 1 – Modeling the NCAA College Football 2000 Network ##
G = nx.read_gml(“football.gml”)
# Print the number of nodes and edges
1.1 Structural Properties of the Graph¶
# Plot the degree distribution using histogram.
# Find the resolution parameter that leads to highest NMI.
# Plot the inter-community connection density as heatmap.
# Print the:
# network diameter,
# characteristic path length (CPL),
# average clustering coefficient,
# transitivity, and assortativity.
1.2 Configuration Model¶
# Generate Graphs
# Plot (Histogram /Boxplot):
# network diameter,
# average clustering coefficient,
# transitivity,
# assortativity.
1.3 Stochastic Block Model Graphs¶
# Generate Graphs
# Plot (Histogram /Boxplot):
# network diameter,
# average clustering coefficient,
# transitivity,
# assortativity.
1.4 Hierarchical Random Graphs¶
dendrogram = nx.read_gml(“football-hrg.gml”)
# Generate Graphs
# Plot (Histogram /Boxplot):
# network diameter,
# average clustering coefficient,
# transitivity,
# assortativity.
# Print the average value and standard deviation for:
# the diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Configuration Model Graphs
# Print the average value and standard deviation for:
# the diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Hypothesis Tests
# Print the following
# P-Values for diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Stochastic Block Model Graphs
# Print the average value and standard deviation for:
# the diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Hypothesis Tests
# Print the following
# P-Values for diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Hierarchical Random Graphs
# Print the average value and standard deviation for:
# the diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Hypothesis Tests
# Print the following
# P-Values for diameter,
# average clustering coefficient,
# transitivity,
# assortativity
# Which model do you think best approximates the empirical network? Explain your answer.
## Part 2 – Estimate the number of nodes and edges in Slashdot dataset ##
G = nx.read_edgelist(“soc-Slashdot0902.txt”, delimiter=”\t”, create_using=nx.DiGraph)
G.remove_edges_from(nx.selfloop_edges(G))
# Part 2.1
# Part 2.2
# Part 2.3
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com