dwave_networkx.markov_network¶
- markov_network(potentials)[source]¶
Creates a Markov Network from potentials.
A Markov Network is also knows as a Markov Random Field
- Parameters
potentials (dict[tuple, dict]) – A dict where the keys are either nodes or edges and the values are a dictionary of potentials. The potential dict should map each possible assignment of the nodes/edges to their energy.
- Returns
MN – A markov network as a graph where each node/edge stores its potential dict as above.
- Return type
Examples
>>> potentials = {('a', 'b'): {(0, 0): -1, ... (0, 1): .5, ... (1, 0): .5, ... (1, 1): 2}} >>> MN = dnx.markov_network(potentials) >>> MN['a']['b']['potential'][(0, 0)] -1