Skip to content

easrai/random-walks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self-Avoiding Walk Simulation

A simple Python simulation of Self-Avoiding Random Walks in 2D. This project simulates multiple walkers that move randomly on a grid without revisiting previously visited positions and visualizes the paths using matplotlib and i have shown some results in the results folder, they are bad because i am bad at matplotlib, but at least they work. Thanks for checking out this project.

What is a Self-Avoiding Walk?

A self-avoiding walk (SAW) is a sequence of moves on a grid where no position is visited more than once. SAWs are important in statistical physics, especially in modeling polymers.

Working

  • uses a list to store position of each walker, the nodes he has visited, and the edges he has used.
  • This list is updated each time he visits a new node, and the new node is selected randomly among the non visited nodes which are at a horizontal or vertical distance of 1 unit from the previous node.
  • In case, no new node can be selected, the program re runs itself, and a bool is used to store this condition.
  • The trajectory of each node is stored in results folder.

Features

  • Simulates multiple independent walkers
  • Ensures self-avoiding behavior using Python sets
  • Visualizes the walks using matplotlib
  • Lightweight: no dependencies beyond the standard library and matplotlib
  • Uses Monte Carlo method.

Usage

  1. Clone this repository:
    git clone https://github.com/easrai/self-avoiding-walk.git
    cd self-avoiding-walk

About

simulates random walks in which no node is repeated again.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages