Question: #URGENT PROBLEM# Independent Cascade Model Python Question: Current Codes: Please provide detailed code with comments before 8 p.m. on January 16. Sincerely thanks in advance.

#URGENT PROBLEM# Independent Cascade Model Python Question:

#URGENT PROBLEM# Independent Cascade Model Python Question: Current Codes: Please provide detailed

Current Codes:

code with comments before 8 p.m. on January 16. Sincerely thanks in

Please provide detailed code with comments before 8 p.m. on January 16.

Sincerely thanks in advance.

Problem 2. (60%+bonus 10%) In this problem, we want to investigate the disease prop- agation by the independent cascade (IC) model in ego-Facebook [1] dataset. Assume the propagation probability is o, and the set of seeds nodes S are randomly selected. Collect the set of infected nodes within the distance D of the seed nodes, and calculate the prevalence rate r1 (which is defined by the ratio of the number of infected nodes to the total number of nodes). Set = 0.1, SI = 5, and D the diameter of the graph. (a) (40%) Simulate the disease propagation by IC model after removing the top 0%, 10%, 20%, ..., 50% of nodes from the following centrality measures respectively, and calculate the corresponding prevalence rate ri. Please plot the curves of r vs. the percentage of nodes removed. (Note: Please run the simulation 100 times and average the results.) import numpy as np import scipy.io import networkx as nx import pandas as pd from igraph import * import matplotlib.pyplot as plt import collections def edge_removal (A, phi): Remove edges by the trick developed by Mollison and Grassberger Args: A: numpy.ndarray Adjacency matrix of the dataset phi: float prob. of the edge is present Returns: A_new: numpy.ndarray Adjacency matrix after edge removal P = np.triu(np.random.random_sample(A. shape),1) = Prob = P+P.T A_new = ((A * Prob)> 1-phi).astype(int) return A_new = mat = scipy.io.loadmat('facebook-ego.mat') A = mat['A'] #Adjacency matrix A = A new = edge removal (A.2.1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!