DiGraph.nameFromId

DiGraph.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.fastDiGraph("A->B")
g.nameFromId(1)
# 'B'
g.addNode()
# 2
g.nameFromId(2)  # no name: the id as a string
# '2'

Used by

DiGraph, DAG

Inheritance diagram of pyagrum.DiGraph, pyagrum.DAG

Overridden in

UndiGraph.nameFromId