Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
cae5227e
Commit
cae5227e
authored
Oct 09, 2017
by
Tiago Peixoto
Browse files
generate_sbm(): Improve docstring
parent
b0427a6c
Pipeline
#379
passed with stage
in 590 minutes and 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/generation/__init__.py
View file @
cae5227e
...
@@ -891,7 +891,11 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
...
@@ -891,7 +891,11 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
Notes
Notes
-----
-----
The graphs are generated with probability
The algorithm generates multigraphs with self-loops, according to the
Poisson degree-corrected stochastic block model (SBM), which includes the
traditional SBM as a special case.
The multigraphs are generated with probability
.. math::
.. math::
...
@@ -932,6 +936,11 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
...
@@ -932,6 +936,11 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
such that the value :math:`\lambda_{rs}` will correspond to the average
such that the value :math:`\lambda_{rs}` will correspond to the average
number of directed edges between groups :math:`r` and :math:`s`.
number of directed edges between groups :math:`r` and :math:`s`.
The traditional (i.e. non-degree-corrected) SBM is recovered from the above
model by setting :math:`\theta_i=1/n_{b_i}` (or
:math:`\theta^+_i=\theta^-_i=1/n_{b_i}` in the directed case), which is done
automatically if ``out_degs`` and ``in_degs`` are not specified.
In case the parameter ``micro_degs == True`` is passed, a `microcanical
In case the parameter ``micro_degs == True`` is passed, a `microcanical
<https://en.wikipedia.org/wiki/Microcanonical_ensemble>`_ model is used
<https://en.wikipedia.org/wiki/Microcanonical_ensemble>`_ model is used
instead, where both the number of edges between groups as well as the
instead, where both the number of edges between groups as well as the
...
@@ -941,7 +950,8 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
...
@@ -941,7 +950,8 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
:math:`{\boldsymbol\theta}\equiv{\boldsymbol k}`, where :math:`e_{rs}` is
:math:`{\boldsymbol\theta}\equiv{\boldsymbol k}`, where :math:`e_{rs}` is
the number of edges between groups :math:`r` and :math:`s` (or twice that if
the number of edges between groups :math:`r` and :math:`s` (or twice that if
:math:`r=s` in the undirected case), and :math:`k_i` is the degree of node
:math:`r=s` in the undirected case), and :math:`k_i` is the degree of node
:math:`i`. The multigraphs are then sampled with probability
:math:`i`. This model is a generalization of the configuration model, where
multigraphs are sampled with probability
.. math::
.. math::
...
@@ -955,6 +965,8 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
...
@@ -955,6 +965,8 @@ def generate_sbm(b, probs, out_degs=None, in_degs=None, directed=False,
P({\boldsymbol A}|{\boldsymbol k}^+,{\boldsymbol k}^-,{\boldsymbol e},{\boldsymbol b}) =
P({\boldsymbol A}|{\boldsymbol k}^+,{\boldsymbol k}^-,{\boldsymbol e},{\boldsymbol b}) =
\frac{\prod_{rs}e_{rs}!\prod_ik^+_i!k^-_i!}{\prod_re^+_r!e^-_r!\prod_{ij}A_{ij}!}.
\frac{\prod_{rs}e_{rs}!\prod_ik^+_i!k^-_i!}{\prod_re^+_r!e^-_r!\prod_{ij}A_{ij}!}.
where :math:`e^+_r = \sum_se_{rs}`, :math:`e^-_r = \sum_se_{sr}`,
:math:`k^+_i = \sum_jA_{ij}` and :math:`k^-_i = \sum_jA_{ji}`.
In the non-degree-corrected case, if ``micro_ers == True``, the
In the non-degree-corrected case, if ``micro_ers == True``, the
microcanonical model corresponds to
microcanonical model corresponds to
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment