Types
TreeHashResult = tuple[subtree, all_roots: seq[uint64]]
- Source Edit
Consts
TREE_HASH_MOD = 2305843009213693951'u64
- Source Edit
Procs
proc all_roots_hash(g: UnDirectedGraph; root: int = 0): seq[uint64]
- 各頂点を根とした木全体のハッシュを O(N) 時間・領域で返す。root は計算開始点。 Source Edit
proc subtree_hash(g: DirectedGraph or UnDirectedGraph; root: int = 0): seq[ uint64]
- root を根とした各頂点の部分木ハッシュを O(N) 時間・領域で返す。有向木は親から子へ辺を張る。 Source Edit
proc tree_hash(g: UnDirectedGraph; root: int = 0): TreeHashResult
- root に対する部分木と、各頂点を根とした木全体のハッシュを O(N) 時間・領域で返す。 Source Edit