I am trying to get an MCMC algorithm (based on a tree structure) implemented / prototyped in Python. I have a problem figuring out how to efficiently randomly select a tree edge (ie. with prob = 1/(n-1)) when the tree is a dictionary {node: [adjacency list], ...}. If I randomly select a node and then an adjacent node, the probability of selecting the edge (defined by the pair) depends heavily on the tree structure. The solution I currently have is potentially less efficient than generating all the edges from the dictionary and selecting one at random. Any ideas. Thanks in advance. Duncan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4