nwtranspose
Transpose a network
Syntax
nwtranspose
[netname]
[,
generate(newnetname)
name(newnetname)
replace]
generate(newnetname) |
Save transpose as new network (alias: name(), matching the rest of this group) |
replace |
if a network named newnetname already exists, drop it and use this name anyway |
Description
Simply transposes a network, i.e. a directed tie from node i to node j is transformed in a directed tie from node j to node i. By default, nwtranspose replaces a network, but you can specify that it should create a new network instead with generate().
Examples
. nwclear
. nwrandom 5, prob(.3) name(net)
. nwsummarize net, matonly
1 2 3 4 5
+---------------------+
1 | 0 0 1 0 0 |
2 | 1 0 0 0 0 |
3 | 0 0 0 1 0 |
4 | 1 1 0 0 1 |
5 | 0 0 1 0 0 |
+---------------------+
. nwtranspose net, generate(net_transp)
. nwsummarize net_transp, matonly
1 2 3 4 5
+---------------------+
1 | 0 1 0 1 0 |
2 | 0 0 0 1 0 |
3 | 1 0 0 0 1 |
4 | 0 0 1 0 0 |
5 | 0 0 0 1 0 |
+---------------------+
Supported network types
Binary: yes. Directed: yes - this command’s entire purpose is transposing a network’s adjacency matrix (a no-op for a genuinely symmetric undirected network). Weighted: yes, tie values are transposed along with tie presence. Signed: yes, values (including negative) are preserved as-is. Two-mode: yes - the flag, the modes and the level labels are kept (the matrix of a two-mode network is symmetric).
nwcommands version 3.17.6, 9 November 2026 (check your installed version)