*! version 1.0.0 12jun2017

Title

nw_fromlist -- Build a network from a list (long data)

Syntax

nw_fromlist
[netname]
[,
node()
id()
direction()
binary
normalize
]

node(varname) Indicate the node variable. Required

id(varname) Indicate Individual variable (if the network is the sum of individual networks) .

direction(varname) Indicate the order variable of linkages for directed networks .

normalize Build a normalized network (max weight=1).

binary Build a binary network (all edges' weights set to 1.

Description

Builds a network from a list (long data) of individuals position on nodes. Returns the squared (weighted) adjacency matrix of nodes.
Previous dataset is deleted.

By default, it computes weighted non-normalized networks, as the sum of individual on each edge.

A directed network might be specified if the positions follow a sequential order, with the option directed(order).

nwcluster also returns the number of nodes and of individuals composing the network.

This is the alorithm to build French multinational enteprises' network from the list of foreign affiliates in Joyez (2017) On The Topological Structure of Multinationals Network, Phys.A(473C)

Examples

*Countries network by enterprises
nwclear
input byte ent str4 iso3 float(year var4) str1 var5
1 "AUT" 1 5 "a"
1 "USA" 2 5 "a"
2 "USA" 1 5 "a"
2 "GBR" 1 5 "a"
3 "GBR" 2 5 "a"
3 "FRA" 2 5 "a"
3 "ESP" 1 5 "a"
4 "ESP" 1 5 "a"
4 "ITA" 1 5 "a"
4 "USA" 2 5 "a"
4 "USA" 3 5 "a"
. "USA" 3 . ""
4 "" 3 . ""
end
. nw_fromlist test,node(iso3) id(ent)
. nwplot

*Countries network by enterprises through time
nwclear
input byte ent str4 iso3 float(year var4) str1 var5
1 "AUT" 1 5 "a"
1 "USA" 2 5 "a"
2 "USA" 1 5 "a"
2 "GBR" 1 5 "a"
3 "GBR" 2 5 "a"
3 "FRA" 2 5 "a"
3 "ESP" 1 5 "a"
4 "ESP" 1 5 "a"
4 "ITA" 1 5 "a"
4 "USA" 2 5 "a"
4 "USA" 3 5 "a"
. "USA" 3 . ""
4 "" 3 . ""
end
. nw_fromlist test,node(iso3) id(ent) direction(year)
. nwplot

*Firms network by countries
nwclear
input byte ent str4 iso3 float(year var4) str1 var5
1 "AUT" 1 5 "a"
1 "USA" 2 5 "a"
2 "USA" 1 5 "a"
2 "GBR" 1 5 "a"
3 "GBR" 2 5 "a"
3 "FRA" 2 5 "a"
3 "ESP" 1 5 "a"
4 "ESP" 1 5 "a"
4 "ITA" 1 5 "a"
4 "USA" 2 5 "a"
4 "USA" 3 5 "a"
. "USA" 3 . ""
4 "" 3 . ""
end
. nw_fromlist test,node(ent) id(iso3)
. nwplot

Saved results

nw_fromlist saves the following in r():

Scalars

r(nb_node) Number of nodes

r(nb_id) Number of indviduals' networks

nw_fromlist also saves the adjacency matrix in a Mata matrix M:
. mata M

See also

nw_fromlist requires the nwcommands package developed by Thomas Grund.

For do-files and ancillary files, see:

. net describe nwcommands-ado, from(http://www.nwcommands.org)
}
For help files, see :

. net describe nwcommands-hlp, from(http://www.nwcommands.org)
}

Author

Charlie Joyez, Paris-Dauphine University
charlie.joyez@dauphine.fr