nwlattice

Generate a lattice network

Syntax

nwlattice
 cols rows
,
[undirected
xwrap
ywrap
name(newnetname)
vars(newvarlist)
xvars
ntimes(int)]
   
cols number of columns in lattice; first positional argument
rows number of rows in lattice; default = 1 if omitted
xwrap wrap horizontally
ywrap wrap vertically
undirected generate an undirected network; default = directed
name(newnetname) name of the new network
vars(newvarlist) new variables that are used for the network
xvars generate Stata variables for the network
ntimes(int) number of networks to be generated; default = 1
noreplace reserved; currently a no-op - the create/replace collision guard on name() already applies regardless

Description

nwlattice generates a lattice network. Each node is connected to maximally four other nodes. With options xwrap and ywrap each node is connected to exactly four other nodes.

Examples

. nwclear
. nwlattice 4 4
. nwplot, label(_nodeid)

. nwclear
. nwlattice 4 4, xwrap ywrap
. nwplot, layout(grid) label(_nodeid)

Supported network types

Binary: yes (only). Directed: yes, via undirected (default is directed). Weighted: not applicable - no weights() option; generates a purely structural lattice. Signed: not applicable. Two-mode: not applicable - this generator always produces a one-mode network.

Stored results

  • nwlattice stores the following in r():

Macros

  • r(netlist) list of new networks

See also


nwcommands version 3.17.6, 9 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.