|
<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Networks, nodes and arcs > Nodes > Creating and deleting nodes |
Use the following methods of the Network class to add or delete nodes. The integer value returned by the node-adding method is the handle of the newly created node, which can be used in subsequent SMILE calls.
Python
add_node(node_type: pysmile.NodeType, node_id: str) -> int
add_node(node_type: pysmile.NodeType) -> int
delete_node(node: int | str) -> None
Java
int addNode(int nodeType, String nodeId)
int addNode(int nodeType)
void deleteNode(int nodeHandle)
void deleteNode(String nodeId)
C#
int AddNode(int nodeType, string nodeId)
int AddNode(int nodeType)
void DeleteNode(int nodeHandle)
void DeleteNode(string nodeId)
R
nodeHandle <- addNode(nodeType, nodeId)
deleteNode(nodeIdOrHandle)
When creating a node, different SMILE wrappers expose node type identifiers in different ways: in Java and C#, they are nested classes with static integer values; in R, they are members of a network instance; and in Python, they are provided as a separate enum type.
Python
net.add_node(pysmile.NodeType.CPT, "node1")
Java
net.addNode(Network.NodeType.CPT, "node1");
C#
net.AddNode(Network.NodeType.CPT, "node1");
R
net$addNode(net$NodeType$CPT, "node1")