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.
Questions tagged [random-walk]
248 questions
0
votes
1 answer
Random Tour Generation Issues
I am trying to generate a random tour from the graph. I am using the adjacency-list method.
There is a problem with the vertices. When I add a vertex to a particular list, the vertex gets added to all the lists in the graph. I do not understand why!…

ayePete
- 411
- 1
- 7
- 23
0
votes
0 answers
Follow random link in the current page every 10 seconds
I cannot find a random walker, that starts with a given URL and goes to a random link in the page every X seconds. Just for fun.
it can be a Firefox extension
it can be a html source file
or it can be a webpage with this functionality somewhere on…

Der Gnirreh
- 198
- 11
0
votes
4 answers
Why does the one-dimensional variant of a 2-d random walk not work?
There is a two-dimensional random walk that one can find here which works perfectly in Octave. However, when I tried to write a one-dimensional random walk program, I got an error. Here is the program:
t=[];
x=[];
for i=1:100000
J=rand;
if…

Ahaan S. Rungta
- 2,323
- 2
- 12
- 15
0
votes
1 answer
How do I include a step counter in a random walk?
In my random walk loop I need to incorporate a function that uses the step number as a variable.
How do I get R to produce a step number (loop counter may be a better term) during a random walk?
I need it right at the end of this code where I…

Jesse001
- 924
- 1
- 13
- 37
0
votes
1 answer
Incorporating a stop function in a random walk
In my previous question:How do I put arena limits on a random walk? the community helped create a random walk function in a set arena. This function is designed to simulate a fish moving through an area, but now I need to make it decide when to…

Jesse001
- 924
- 1
- 13
- 37
0
votes
1 answer
Python: How To Recursively Simulate a Random Walk Within a Range (No Loops)
A friend bet me I couldn't write this recursively. Unfortunately he won, but I am still wondering how I would go about doing this:
The function is: rw_in_range(start, low, high)
The inputs are:
start - a positive int that represents the…

Evan Porter
- 15
- 1
- 6
0
votes
1 answer
python randomwalk not walking
my professor has given me this code and the only part im suppose to do is the TODO area. i am rather new to python still and have never touched on this type of project so i am rather confused. all this project is for is to get the plotted graph…

user3804711
- 133
- 3
- 13
0
votes
1 answer
Probability of returning to the origin for a 3 dimensional random walk
Here is my code simulating a code in python simulating a random walk in 3 dimensions. It returns a percentage of times the walk returns to the origin. Polya's constant was ~ 34% probability for a walk to return to the origin in 3 dimensions. My…

pauld
- 401
- 1
- 5
- 20
0
votes
1 answer
How can I plot a 2 dimensional random walk in python?
I wrote the code for a two dimensional random walk:
def r2walk(T):
x = np.zeros((T))
y = np.zeros((T))
x = [0]*T
y = [0]*T
for t in range(0,T):
walk = random.random()
if 0 < walk < .25:
x[t] = x[t-1] +…

pauld
- 401
- 1
- 5
- 20
0
votes
1 answer
MATLAB, three dimensional matrix with varying second dimension
I need a 3 dimensional matrix but the first dimensions are not the same. So I have say NxT1 (N by T1) , NxT2 NxT3 and NxT4. and I want to put them in one matrix so can I loop through each dimension. Here is my code:
y2(:,:,1) =…
Jonas
0
votes
1 answer
Keeping count in a recursive function
I saw a few posts about keeping count of the number of iterations of a recursion but I couldn't follow or they didn't apply. Sorry if it is redundant though! I appreciate the help! I am trying to right a function for a random walk situation using a…

user3517740
- 47
- 3
- 12
0
votes
0 answers
Metropolis Hastings Random Walk SQL Implementation
Is it possible and efficient to implement MHRW algorithm in SQL?
I want to sample a direct large graph with +1 million nodes and this seems to be one of the best ways to do it. The purpose of the algorithm is for undirect graphs, but I think it can…

npereira
- 145
- 1
- 2
- 8
0
votes
0 answers
Random walk Distribution Histogram in R
I want to study the distribution (histogram of the values of S greater than 0 for n=10000 replicated 10000 times. However, I'm not getting the correct output, how can I go about obtaining the histogram? Here's what I…

user3347124
- 153
- 1
- 2
- 7
0
votes
2 answers
Efficient way to allow for an n-dimensional coordinate?
I am currently building a program that will calculate a self-avoiding walk in n-dimensions.
The program has to have a list of coordinates that it has previously visited.
For a known maximum number of dimensions, I would simply make a vector of a…

NictraSavios
- 502
- 2
- 9
- 29
0
votes
1 answer
how to avoid overlaps during midpoint displacement? (2D)
hell-o guys!
well, I'm playing with random walks. Midpoint displacement gives some nice results, but I would like a random walk without walk loops, like the ones (in yellow) on this screen-hot :
My first idea to deal with that problem is to check…

The Unholy Metal Machine
- 1,093
- 2
- 17
- 36