MarkovRandomField.nodeId

MarkovRandomField.nodeId(var)

Return the node id of a variable.

Parameters:

var (pyagrum.DiscreteVariable) – the variable

Returns:

the node id of the variable

Return type:

int

Raises:

pyagrum.NotFound – if the variable does not exist in the model

Example

import pyagrum as gum

mrf = gum.fastMRF("A--B;B--C")
mrf.nodeId(mrf.variable("B"))
# 1

Class

MarkovRandomField