Question: !!URGENT!! Independent Cascade Model Python Please help me to solve this problem set. Please provide the code and comments to let me know what codes
!!URGENT!! Independent Cascade Model Python
Please help me to solve this problem set. Please provide the code and comments to let me know what codes are doing for. Sincerely thanks in advance.

Need your help before tomorrow 8 p.m.
Current Codes

Following steps



![the independent cascade (IC) model in ego-Facebook [1] dataset. Assume the propagation](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f93b4744ab5_67066f93b46de1b3.jpg)

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 2: Define the n x 1 seed vector x by I i 1, 0, for i ES for i & S S = {2} 1 4 7 3 6 10] 1 0 0 0 0 0 = 2 5 un 8 = Step 3: Calculate y=(A+1)Px with the AND Dx and the OR operations. D=1 1 4 7 3 6 0 1 1 0 0 0 2 5 y = (A+1)x = 8 18. 0 = Step 3: Calculate y = (+1)Px with the AND and the OR operations. D = 2 6 2 y= (+1)2x X = = Step 3: Calculate y = (+1)Px with the AND y and the OR operations. D=3 1 4 7 3 6 2 5 y = (+1)3x = 1 1 0 1 0 0 8 Step 4: Obtain the number of infected nodes by counting the number of ls in vector y. D=3 6 y = ||4||1 = 5 = 1 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
