Make x as a set.
(x: Node)
| 12 | |
| 13 | |
| 14 | def make_set(x: Node) -> None: |
| 15 | """ |
| 16 | Make x as a set. |
| 17 | """ |
| 18 | # rank is the distance from x to its' parent |
| 19 | # root's rank is 0 |
| 20 | x.rank = 0 |
| 21 | x.parent = x |
| 22 | |
| 23 | |
| 24 | def union_set(x: Node, y: Node) -> None: |
no outgoing calls