Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lotrien/percolation
Site percolation (Monte Carlo simulation)
https://github.com/lotrien/percolation
algorithm monte-carlo-simulation percolation simulator site-percolation-simulation union-find visualization
Last synced: about 1 month ago
JSON representation
Site percolation (Monte Carlo simulation)
- Host: GitHub
- URL: https://github.com/lotrien/percolation
- Owner: lotrien
- License: mit
- Created: 2019-01-07T21:07:08.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-10T23:05:27.000Z (almost 2 years ago)
- Last Synced: 2023-03-24T00:21:33.211Z (almost 2 years ago)
- Topics: algorithm, monte-carlo-simulation, percolation, simulator, site-percolation-simulation, union-find, visualization
- Language: JavaScript
- Homepage:
- Size: 461 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Site percolation (Monte Carlo simulation)
![Build Status](https://github.com/lotrien/percolation/actions/workflows/deploy.yml/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[DEMO](https://percolation.yetanother.one/)
I model the system as an n-by-n grid of sites. Each site is either blocked (black) or open (white);
open sites are initially empty. A full site is an open site that can be connected to an open site
in the top row via a chain of neighboring (up, down, left, right) open sites.If there is a full site in the bottom row, then we say that the system percolates.
### Algorithm:
> A disjoint-set (also called a _Union-Find_) data structure is a data structure that keeps track of a set
> of elements partitioned into a number of disjoint (non-overlapping) subsets.A union-find algorithm is an algorithm that performs two useful operations on such a data structure:
- **Union**: Join two subsets into a single subset.
- **Find**: Determine which subset a particular element is in. This can be used for determining if
two elements are in the same subset.