(Not too off topic I hope?) problem
Duncan Smith
buzzard at urubu.freeserve.co.uk
Wed Apr 18 11:22:06 EDT 2001
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
More information about the Python-list
mailing list