Code adapted from paper by Tiziano Squartini, Rossana Mastrandrea, and Diego Garlaschelli (2015), Unbiased sampling of network ensembles. New J. Phys. 17 023052.
The original package was originally published by here: A Matlab package to randomize and sample networks by a max-entropy approach for several null models
Generating ensemble using the MATLAB script:
MATLAB >> pairks=load(strcat('network_degree_sequence.txt')))
MATLAB >> outputs = MAXandSAM('UBCM',[],pairks,[],10^(-6),0);
MATLAB >> path = '/path_to_samples_folder/network_name-'
MATLAB >> for i=1:num
........ W_ext=samplingAll(outputs,'UBCM');
........ edges=adj2edge(W_ext);
........ name=strcat(path,num2str(i));
........ dlmwrite(strcat(name,'.txt'),edges)
........ end
MATLAB >> pairks=load(strcat('network_degree_and_strenght_sequence.txt')))
MATLAB >> outputs = MAXandSAM('UECM',[],pairks,[],10^(-6),0);
MATLAB >> path = '/path_to_samples_folder/network_name-'
MATLAB >> for i=1:num
........ W_ext=samplingAll(outputs,'UECM');
........ edges=adj2edge(W_ext);
........ name=strcat(path,num2str(i));
........ dlmwrite(strcat(name,'.txt'),edges)
........ end
MATLAB >> SaveSpatialModelSamples('network_name.txt',1000)
Since we published the paper, it was released a version of the MATLAB package for Python. Please refer to the repository NEMtropy: Network Entropy Maximization, a Toolbox Running On PYthon for the Python code that generates the ensembles.
- Tiziano Squartini, Rossana Mastrandrea, and Diego Garlaschelli (2015), Unbiased sampling of network ensembles. New J. Phys. 17 023052.
- Rossana (2022). MAX&SAM package.zip, MATLAB Central File Exchange. Retrieved April 7, 2022.
- Nicolò Vallarano, Matteo Bruno, Emiliano Marchese, Giuseppe Trapani, Fabio Saracco, Tiziano Squartini, Giulio Cimini, and Mario Zanon (2021) Fast and scalable likelihood maximization for Exponential Random Graph Models. Arxiv:2101.12625