01/29/2011: This program has been superseded by NETGEN 1.1.2.
01/17/2011: Version 1.1.1. The command NETGEN generates matrix representations, betweenness centrality, and clustering coefficients for undirected or directed networks with or without weights. The program now offers (hopefully) a better syntax and is a bit faster than NETWORK SGL (though routines are still very slow for large undirected networks compared to other software). The module allows users to use, in addition to edge (arc) list defined as Stata variables, edge (arc) list matrix and adjacency matrix stored in Mata. When using Stata variables, users can retrieve information on the generated matrices (such as row sum and column max) and merge them to the master dataset in one step. The attached zip file contains the files described below.
I would like to thank Rense Corten, Galina Hale, and reviewers at Stata Journal for their valuable inputs in improving the program and the documentation. Please contact me for bugs, concerns, and comments. Thank you.
NETWORK_SGL01201102main.pdf: Revised and re-submitted working paper.
netgen.sthlp: Stata help file for NETGEN command.
netgen.ado: NETGEN ado-file wrapper for Mata library.
lsgl3.mlib: Mata library for NETGEN.
florentine_marriages.dta: 15th century Florentine marriages dataset from Padgett and Ansell (1993).
lsg3 folder: Contains auxiliary Mata files that make up lsgl3.mlib Mata library.
lsgl3.do: Mata file compiler - compiles lsgl3.mlib.
adjacency_list.mata: Generates adjacency list.
adjacency_matrix.mata: Generates adjacency matrix.
betweenness.mata: Generates betweenness centrality for unweighted networks.
bfs.mata: Breadth-first search (BFS) algorithm to generate distance and path matrices for unweighted networks.
clean_list.mata: Removes loops and isolates from edge (arc) list.
clustering.mata: Generates local and overall/average clustering coefficients.
component_matrix.mata: Generates component matrix using BFS.
dijkstra.mata: Generates distance and path matrices for weighted networks using Dijkstra's algorithm.
dijkstra_betweenness.mata: Generates betweenness centrality for weighted networks using matrices from implementing Dijkstra's algorithm.
display_status.mata: Outputs status dots.
edge_list.mata: Generates edge (arc) list matrix based on relational data from Stata dataset.
full2sparse.mata: Routine to convert full matrix to sparse matrix.
gen_stvar.mata: Routine to merge specified vectors in r() to Stata master dataset.
new_list.mata: Routine to generate new encoded edge (arc) list from user specified edge (arc) list matrix or adjacency matrix stored in Mata.
print_matrix.mata: Routine to print matrix to external file.
r_return_stats.mata: Routine to output matrix characteristics to r().
sgl3.mata: Class wrapper program.
sparse2full.mata: Routine to convert sparse matrix into full matrix.