@@ -13,8 +13,11 @@ For example, if you want to generate a graph following the stochastic block mode
from lib.random import stochastic_block_model_graph
G = stochastic_block_model_graph(nb_nodes=300,nb_edges=1200,nb_com=5,percentage_edge_betw=0.01)
Graph Models
------------
Stochastic Block Model
----------------------
^^^^^^^^^^^^^^^^^^^^^^
This model partitions :math:`n` vertices in :math:`k` blocks, and places edges between pairs of nodes with a probability that depends on the vertices membership. The probability of a pair of nodes is computed based four parameter, the number of vertices :math:`|V|` and edges :math:`|E|`, the number of blocks :math:`|B|` and finally, the percentage of interlinks :math:`per_{betw}`, i.e number of selected pairs of nodes that belongs to different blocks.
First, we assign randomly a block :math:`b_i \in B` for each node :math:`v \in V`. In this model, all blocks are associated with the same number of nodes :math:`\frac{|V|}{|B|}`. Second, to compute the probability of a pair of nodes to be connected, we use the function :math:`f(u,v)` defined as follows:
...
...
@@ -46,7 +49,7 @@ To compute the :math:`p_{in}` and :math:`p_{out}`, we do the following:
Spatial Model
-------------
^^^^^^^^^^^^^
This model generate a graph with $n$ vertices and $e$ edges selected randomly. Edges are selected using the deterrence function defined in the following formula:
.. math::
...
...
@@ -57,18 +60,20 @@ where :math:`u` and :math:`v` are two vertices and :math:`p_u` and :math:`p_v` c
Nodes coordinates can be generated randomly or randomly selected from existing places (here countries centroids).
ER Random Graph
---------------
^^^^^^^^^^^^^^^
The model returns a Erdős-Rényi graph or a binomial graph. Basically,
the model generates a graph :math:`G_{n,m}` where :math:`n` corresponds to the number of vertices
and :math:`m` the number of edges in :math:`G_{n,m}`. In this model, each pair of nodes has the same
probability to be connected.
Configuration model
-------------------
^^^^^^^^^^^^^^^^^^^
The configuration model generates a graph (graph with parallel edges and self loops) by randomly assigning edges to match a given degree distribution. In our case, generated graph degree distribution follows a powerlaw. We use the Molloy-Reed approach [molloy1995critical]_ to generate the graph.
.. [molloy1995critical] Molloy, M., & Reed, B. (1995). A critical point for random graphs with a given degree sequence. Random structures & algorithms, 6(2‐3), 161-180.
Generate a graph dataset based on different models and configurations