Class: Ogr::UnionFind
- Inherits:
-
Object
- Object
- Ogr::UnionFind
- Defined in:
- lib/ogr/union_find.rb
Overview
Class implements Union Find algorithm
Instance Method Summary collapse
- #connected?(x, y) ⇒ Boolean
-
#initialize(n) ⇒ UnionFind
constructor
A new instance of UnionFind.
- #union(x, y) ⇒ Object
Constructor Details
#initialize(n) ⇒ UnionFind
Returns a new instance of UnionFind.
7 8 9 10 |
# File 'lib/ogr/union_find.rb', line 7 def initialize(n) @store = (0..n).to_a @sizes = [1] * n end |