Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code provided: def rwgraph(G,i0=0,M=100,Nt=100): Simulate M Nt-step random walks on input graph, G, with all walkers starting at node i0 Input: G: An undirected,
Code provided:
def rwgraph(G,i0=0,M=100,Nt=100): """ Simulate M Nt-step random walks on input graph, G, with all walkers starting at node i0 Input: G: An undirected, unweighted NetworkX graph i0: intial node for all walks M: Number of walks Nt: Number of steps per walk Output: X: M x Nt+1 array containing the simulated trajectories """ X = np.zeros((M,Nt+1)) #Add code here return X1) (5 pts) For this question, you will investigate random walks on unweighted, undirected graphs. One step of a random walk is defined as follows. The probability of a walker moving from node i to nodej is pij = Aij/qi where Aij is the adjacency matrix for the graph, and qi is the degree of node i. i) Complete rwgraph so that it efficiently simulates M Nt-step random walks on the NetworkX graph provided as input. All walkers should start at the same node with the this node set via input variable, io. Provide a 1-2 sentence description of your algorithm for 1 simulation step in your pdf. 1) (5 pts) For this question, you will investigate random walks on unweighted, undirected graphs. One step of a random walk is defined as follows. The probability of a walker moving from node i to nodej is pij = Aij/qi where Aij is the adjacency matrix for the graph, and qi is the degree of node i. i) Complete rwgraph so that it efficiently simulates M Nt-step random walks on the NetworkX graph provided as input. All walkers should start at the same node with the this node set via input variable, io. Provide a 1-2 sentence description of your algorithm for 1 simulation step in your pdf
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