nodeid

Identification of nodes

nodeid

A nodeid is an integer number used to identify nodes in a network. Every node in a network is automatically assigned a nodeid. The range of these numbers goes from 1 to size of the network, where every integer number identifies exactly one node. When a node is deleted, the nodeid’s of all other nodes are automatically changed, so that all consecutive numbers from 1 to size of the network correspond to one node. When attributes (saved as Stata variables) are used, the variable value of row i corresponds to the attribute of the node with nodeid i. Nodeid’s cannot be changed by the user other than when nodes are deleted.

nodelab

A nodelab is more flexibile than a nodeid and attaches a unique word to each node for identification. Node labels can be changed with nwname, newlabsfromvar(varname). Node labels uniquely identify nodes in a network.

Finding the nodeid and nodelab

Both nodeid and nodelab of nodes can be found out easily. The most simple way is probably to use nwload. This generates the variable _nwnode, which holds the node labels in the order of the nodeids.

If one wants to know the nodelab that corresponds to a nodeid one can use _nwnodelab. The other way around, when one knows a nodelab and wants to know the nodeid of a node, one can use _nwnodeid.

  • For example,
. _nwnodelab, nodeid(9) detail

----------------------------------------
  Network: flomarriage
----------------------------------------
    Nodeid: 9
    Nodelab: medici

nwcommands version 3.25.0, 14 November 2026 (check your installed version)


Back to top

nwcommands is free software under the GNU General Public License, version 3, as are the model packages nwsaom, nwergm, nwdynam and nwrem. Citing and licenses · Get help · GitHub. Issues with the core go to the nwcommands repository; issues with a model package go to that package's own repository.

This site uses Just the Docs, a documentation theme for Jekyll.