Gratis also supports a command line interface that can be used in order to generate graphs.
-
Help
python app.py -h
-
Gratis version
python app.py -v
Available graph models:
Graph model | Number |
---|---|
Homogeneous | 1 |
Erdős Rényi | 2 |
Custom Erdős Rényi | 3 |
Random Fixed | 4 |
Scale Free | 5 |
Custom Scale Free | 6 |
Graph creation examples:
-
Creating a Homogeneous graph with 10 nodes:
python app.py -g -m 1 -nov 10
-
Creating an Erdős Rényi graph with 10 nodes, 0.5 probability of connection and the number 7 as the seed:
python app.py -g -m 2 -nov 10 -p 0.5 -s 7
-
Creating a Custom Erdős Rényi graph with 10 nodes, 0.5 probability of connection, 12 edges, and the number 7 as the seed:
python app.py -g -m 3 -nov 10 -p 0.5 -noe 12 -s 7
-
Creating a Random Fixed graph with 10 nodes, 3 graph degree, and the number 7 as the seed:
python app.py -g -m 4 -nov 10 -gd 3 -s 7
-
Creating a Scale Free graph using the Preferential Attachment mechanism with 10 nodes, and the number 7 as the seed:
python app.py -g -m 5 -nov 10 -s 7
-
Creating a Full Scale Free graph using the Preferential Attachment and the Incremental growth mechanisms with 10 nodes, 3 initial nodes, and the number 7 as the seed:
python app.py -g -m 5 -nov 10 -noin 3 -s 7
-
Creating a Custom Scale Free graph using the Preferential Attachment mechanism with 10 nodes, 12 edges, and the number 7 as the seed:
python app.py -g -m 6 -nov 10 -noe 12 -s 7
-
Creating a Custom Full Scale Free graph using the Preferential Attachment and the Incremental growth mechanisms with 10 nodes, 3 initial nodes, 2 initial connections per node, and the number 7 as the seed:
python app.py -g -m 6 -nov 10 -noin 3 -icpn 2 -s 7
The default graph representation is as an Adjacency Matrix. This can be changed by using the -gr
flag
which stands for graph representation
e.g.:
python app.py -g -m 3 -nov 10 -p 0.5 -noe 12 -s 7 -gr 2
Available graph representations:
Graph representation | Number |
---|---|
Adjacency Matrix | 1 |
Adjacency List | 2 |
Note: The python app.py
should be replaced by the corresponding gratis executable/binary file e.g.:
./gratis -g -m 3 -nov 10 -p 0.5 -noe 12 -s 7
-
In order to run this project you need:
- Python3 or above
-
To install all needed packages and run the project:
2.1. Debian and Ubuntu based systems:- Clone or download zip and extract the project.
cd Gratis/
sudo ./install-dependencies.sh
python3 app.py
2.2. Windows systems:
- Download and install python3 and above from https://www.python.org/ (python3.6 is the safe choice)
- Download the appropriate python-igraph module for your windows system with the appropriate python version you installed. (e.g. if you have python3.6 and windows 64-bit you will download the file
python_igraph‑0.7.1.post6‑cp36‑cp36m‑win_amd64.whl
from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-igraph. - Install the python-igraph module with
python -m pip install <module_name.whl>
- Clone or download zip and extract the project.
cd Gratis\
python -m pip install -r requirements.txt
python app.py
-
To install and run through pipenv:
- Download and install python3 or above.
python3.x -m pip install pipenv
(Note: .x is a wildcard)cd Gratis
pipenv install
pipenv shell
python app.py