document directed union-find lookup in bulk_utils for clarity
This commit is contained in:
parent
51855f91ae
commit
de01609540
1 changed files with 1 additions and 0 deletions
|
|
@ -80,6 +80,7 @@ def _build_directed_uuid_map(pairs: list[tuple[str, str]]) -> dict[str, str]:
|
||||||
parent: dict[str, str] = {}
|
parent: dict[str, str] = {}
|
||||||
|
|
||||||
def find(uuid: str) -> str:
|
def find(uuid: str) -> str:
|
||||||
|
"""Directed union-find lookup using iterative path compression."""
|
||||||
parent.setdefault(uuid, uuid)
|
parent.setdefault(uuid, uuid)
|
||||||
root = uuid
|
root = uuid
|
||||||
while parent[root] != root:
|
while parent[root] != root:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue