Please see the original research at XXX.
This repository contains four folders:
- cyclesmap: calculations of chordless cycles in a given network.
- create_SD: generation of
$\mathbb{S}^D$ surrogates of a given network. - create_feats: calculation of chordless cycles in a set of surrogates.
- dimension: detection of optimal dimension of a network.
The workflow to detect the optimal dimension of a given network is:
- Calculation of chordless cycles of the network:
$ ./cyclesmap/cyclesmap network network_features
- Generation of surrogates of the network:
$ ./create_SD/create_SD.sh network resolution n_poll wsize nrealizations maxD
- calculation of the chordless cycles of the surrogates:
$ ./crete_feats/create_feats.sh SDnets/network SDfeats/network
- Detection of optimal dimension using Python 3.x (from dimension folder):
$ python -c'import dimension; dimension.dimension(SDfeats/network,network_features,["triangles", "squares","pentagons"],maxk)'
The following is a brief description of the codes contained in each folder (more information can be found in the corresponding sh and py files).
Contains the program cyclesmap to calculate the number of chordless cycles of length 3,4 and 5 of a given network.
Parameters:
- network: The name of a file contaning an edge list of a network.
Contains the script create_SD.sh to generate
The script requires an edgelist of the given network and a parameter setting.
Parameters:
- network: name of the network (edgelist file must be located in RealNets folder with edge extension and features file in RealFeats with csv extension)
- resolution: number of surrogates per dimension
-
n_poll: number of points used to infer the relation Clustering vs.
$\beta$ - wsize: size of the clustering interval in which to create the surrogates
-
nrealizations: number of realizations per random
$\beta$ value (default=1) -
maxD: the script will generate surrogates from
$D$ =1 to$D$ =maxD
The resulting surrogates will be placed in SDnets folder. Some folders will be created during the process for calculation purposes.
Contains the script create_feats.sh to calculate chordless cycles from a set of surrogates.
Parameters:
- surrogates_folder: name of the folder containing surrogates (they should be organized by dimension, as obtained with create_SD.sh script)
- results_folder: name of the destination folder to store the results
This folder contains the dimension.py Python library which provides functions to infer the optimal dimension of a network given a set of features (chordless cycles counts) of its surrogates. The code requires a folder with surrogate features organized by dimension, as obtained with create_feats.sh script.
The main function of this library is dimension whith following parameters:
- surrogate_set: the name of a folder with surrogate features organized by dimension, as obtained with create_feats.sh
- network_features: the name of a file containing network features obtained with cyclesmap script
- predictors: a set of predictors (a subset of ['triangles', 'squares','pentagons'])
-
maxk: a maximum value of
$k$ to explore
This function returns the optimal dimension for the given network, the value of k and the accuracy for the kNN method.
Pedro Almagro, Marián Boguñá, M. Ángeles Serrano
Universitat de Barcelona | Universidad de Sevilla
September 7, 2022
Questions related to code: [email protected]