Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tip selection pseudocode
- def pick_tip(tangle, tips):
- tovisit = queue(tips.copy())
- while !tovisit.empty():
- tx = tovisit.poll()
- tx.weight = sum(tx.approvees.weights) + 1
- if tx.depth < maxdepth and random_bool(P_drop_tx):
- tovisit.push(tx.branch, tx.trunk)
- walktx = random tx in tangle where depth == maxdepth
- while walktx not in tips:
- walktx = weighted_random(walktx.approvees)
- return walktx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement