<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Networks, nodes and arcs > Nodes |
Within a network, each node is uniquely identified by its handle, a non-negative integer that is preserved when the network is copied. Node handles are not guaranteed to be consecutive or start from any particular value.
In addition to handles, each node has a unique textual identifier within its containing network. This identifier can be specified when creating the node via the Network.add_node method and may be changed later. A node’s identifier can be converted to its handle using Network.get_node, and conversely, a handle can be converted to an identifier using Network.get_node_id. See the Identifiers section for rules on valid node identifiers.
All methods of the Network class that operate on nodes accept either handles or identifiers. Note that methods using identifiers perform an O(N) string lookup (where N is the number of nodes), whereas methods using handles require only an O(1) validity check.