![]() If heads (1) then move to a uniformly chosen linked node from the current position Then 'flip' a biased coin (probability of heads is F). Pick a random node to start the chain with. Now we have the graph, we can simulate the MC on the nodes. # Or perhaps just the links from a particular node ![]() # Or maybe we're interested in all the links This just lets us print the connections nicely # We can iteratively move through the dict ![]() Returns the set of such nodes using the supplied (or empty) graphdictĪlso useful to record a list of all nodes: Then there are 4 nodes and node p2 only has a link to itself, but is linked from p3Ĭan get all the nodes linked from a given node We suppose the dictionary keys are the nodes of the graph,Īnd the values of the dict are the nodes that the key node links to, e.g. If no dictionary is supplied, then we begin with the empty dict
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |