MAG.nameFromId

MAG.nameFromId(id)

Return the name of a node, or its id as a string if no name was set.

The names of the nodes are kept from the graph the immutable graph was built from.

Parameters:

id (int) – the node id

Returns:

the name associated with the node, or str(id) if the node has no name

Return type:

str

Example

import pyagrum as gum

dag = gum.fastDAG("A->X;Y<-B;X<-T->Y")
mag = gum.MAG.fromDAG(dag, {4})  # T latent: A->X<->Y<-B
mag.nameFromId(1)
# 'X'

Class

MAG