Questions tagged [random-walk]

A random walk is a mathematical formalization of a path that consists in a succession of random steps. A random walk can be a Markov chain or process; it can be on a graph or a group. Random walks can model randomized processes, in fields such as: ecology, economics, psychology, computer science, physics, chemistry, and biology.

248 questions
1
vote
1 answer

Animated matplotlib imshow

Let me first clarify that I'm not trying to generate random walk lines like in this and many other questions. I'm trying to make a random walk heat map that changes color as points are revisted, like this. I've been able to create still-lifes like…
data princess
  • 1,130
  • 1
  • 23
  • 42
1
vote
1 answer

How to repeat random walk simulation and record end results in MatLab?

Hi I am working on my first random walk program. I was just able to figure out the random walk program itself. It is a simple 1d random walk, with 1000 steps. Here is what my code looks like so far: stepslim = 1000; rnew(1) = 0 r=0; %Now we will set…
1
vote
3 answers

Simulating a random walk in Python

I am using Python 3. My code below attempts to simulate N steps of a random walk in 3 dimensions. At each step, a random direction is chosen (north, south, east, west, up, down) with 1/6 probability each and a step of size 1 is taken in that…
NOK
  • 11
  • 2
  • 3
1
vote
1 answer

is there package exist in python to do RWR(random walk with restart)

is there some package or function that to compute RWR in python? i want to compute RWR using weighted graph. but i can't find RWR package in python. plz tell me that package name if exist in python. or please see me some example RWR in python. thank…
L.kyunam
  • 53
  • 12
1
vote
2 answers

Python: matplotlib: coloring lines in a random walk by jump size

I have code that generates and plots a random walk just fine. However, I want to color each line according to how big of a jump it is. This is my code: import matplotlib.pyplot as plt import numpy as np import random def randomwalk(N): x, y,…
dain
  • 672
  • 1
  • 7
  • 22
1
vote
1 answer

Traversing a directed graph randomly

I have a directed graph and the following program traverses the graph from a random start point to a random finish point.What I need it to do is to traverse randomly through the graph x amount of times, randomly selecting a node each time from the…
user2987377
  • 91
  • 2
  • 9
1
vote
1 answer

Random Walk with MPI: Why are my messages getting lost?

I am trying to develop a parallel random walker simulation with MPI and C++. In my simulation, each process can be thought of as a cell which can contain particles (random walkers). The cells are aligned in one dimension with periodic boundary…
1
vote
2 answers

Problems with Boolean Array in Self-Avoiding Random Walk Program?

My program uses StdDraw to create an N-by-N grid. I'm supposed to accept N and T in the command line (N is the number of lines in the grid, T is the number of times I can try to escape the grid in a random walk). I keep getting an error that…
Bianca Fuller
  • 39
  • 1
  • 9
1
vote
2 answers

Computing the mean square displacement of a 2d random walk in Python

I'm simulating a 2-dimensional random walk, with direction 0 < θ < 2π and T=1000 steps. I already have a code which simulates a single walk, repeats it 12 times, and saves each run into sequentially named text files: a=np.zeros((1000,2),…
user4142446
1
vote
0 answers

limit random walk in matlab

I'm trying to generate a model of a random walk within the confines of a cell wall. I have the following code for discrete stepping within the cell: x(1000)=0; t(1000)=0; dt=1; kB=1.381e-23; T=310; R=4.89e-9; visc=0.007; friction=6*pi*visc*R;…
manateem
  • 11
  • 1
1
vote
2 answers

How to Recursively Simulate a Random Walk? No Loops (Python)

Python Question I have a function for 1 random step: def random_step(): """ chooses a random step (-1 or 1) and returns it. inputs: none! However, make sure to use parens when calling it. For example: ramdom_step() """ …
Evan Porter
  • 15
  • 1
  • 6
1
vote
1 answer

reflecting random walk in matlab?

I have a array of 10 vectors 'x' with as below (for simulating 1D random walk): r=rand(10,1000); r(r>.5)=1; r(r<=.5)=-1; x=cumsum(r); The image of the one vector will be like: If I consider 2 values in the sequence , say +10 and -10, then I would…
dexterdev
  • 537
  • 4
  • 22
1
vote
1 answer

Generate Random Walk with Drift and/or Trend in R

Generating a Random Walk in R is pretty easy. It's done by the following code: x <- rnorm(100) y <- cumsum(x) But how do I generate/simulate a Random Walk with Trend and / or Drift?
user3750030
  • 327
  • 3
  • 7
1
vote
2 answers

Beginner C++ - Simple random walk program with a strange setw bug

I've been tasked with creating a very simple random walk program for a C++ class. I wrote it and was fairly sure everything was correct but I am getting this strange bug. From 0 to 10 the steps line up even though the coordinates show that its…
TimmyG
  • 13
  • 1
  • 4
1
vote
1 answer

current_flow_betweenness_centrality for directed graph using networkx?

I am working with a citation network and I would like to calculate the sum of probabilities of visiting a given node in the network from any other node in the network on a random walk. My understanding is that currentflow_betweeness_centrality is a…
biased_estimator
  • 723
  • 3
  • 7
  • 13