dgl.DGLGraph.has_node

DGLGraph.has_node(vid)

Return True if the graph contains node vid.

Identical to vid in G.

Parameters:vid (int) – The node ID.
Returns:True if the node exists
Return type:bool

Examples

>>> G = dgl.DGLGraph()
>>> G.add_nodes(3)
>>> G.has_node(0)
True
>>> G.has_node(4)
False

Equivalently,

>>> 0 in G
True

See also

has_nodes()