UndiGraph.nameFromId

UndiGraph.nameFromId(id)

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

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

g = gum.fastUndiGraph("A-B")
g.nameFromId(1)
# 'B'
g.addNode()
# 2
g.nameFromId(2)  # no name: the id as a string
# '2'

Used by

UndiGraph, ChainGraph, CliqueGraph, MixedGraph, PDAG

Inheritance diagram of pyagrum.UndiGraph, pyagrum.ChainGraph, pyagrum.CliqueGraph, pyagrum.MixedGraph, pyagrum.PDAG