UFDS
Instantiate a UFDS with a number of disjoint sets
Usage
UFDS(sets:int)
Parameters:
sets : int
The number of disjoint sets to create
Methods
Method | Description |
---|---|
find_set | Finds the representative node of the set containing 'item_number' |
is_same_set | Checks if 2 items belong to the same set |
union | Unions 2 sets together |
move | Move an item from its original set to a new set |
count_items | Count the number of items in a particular set |
Example
from jellybeans.structures import UFDSufds = UFDS(10) # 10 disjoint sets are created