Skip to content

Latest commit

 

History

History
61 lines (51 loc) · 3.21 KB

README.md

File metadata and controls

61 lines (51 loc) · 3.21 KB

network-generator

MATLAB package to generate synthetic and empirical networks.

For some standard networks, it uses Python's networkx library for standard network generation. For other networks, it borrows code from other sources (e.g., Ann's website and the Brain Connectivity Toolbox). You can also easily add other methods for generating networks.

Installation

Clone network-generator to your MATLAB environment. Rename directory to +net. No need to add to path.

You need python and networkx installed for some topologies (see API).

Use

To generate a topology, call net.generate(). Specify the topology and any other parameters in name-value pairs (à la plot). For example,

n = net.generate('erdosrenyi',...
  'n',20,...
  'p',0.3,...
  'dir',true);
imagesc(n.A)

To generate a weight distribution, call net.distr_weights(). Specify the topology, the weight distribution, and any other parameters in name-value pairs. For example,

w = net.distr_weights(n.A,'truncnorm',...
    'mu',0,...
    'sigma',0.1,...
    'range',[0 2]);
histogram(w.A(w.A>0))

Available network topologies

For topologies and their parameters, see API.

BYO topologies
  1. Write a function that generates a topology, and add to the +generators directory (see examples there). Add any auxiliaury code in +imported.
  2. Update +generators/README.md.
  3. Submit a pull request if you want to share your code.

Available weight distributions

BYO weighting distributions
  1. Write a function that generates a distribution of weights, and add to the +weights directory (see examples there).
  2. Update +weights/README.md.
  3. Submit a pull request if you want to share your code.

Troubleshooting

  1. If your MATLAB can't find networkx, then see this.