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
d70825df
Commit
d70825df
authored
Jun 26, 2018
by
Tiago Peixoto
Browse files
Docstring cross-reference cleanup
parent
b7f1f2a9
Changes
22
Hide whitespace changes
Inline
Side-by-side
doc/conf.py
View file @
d70825df
...
...
@@ -54,7 +54,7 @@ master_doc = 'index'
# General information about the project.
project
=
u
'graph-tool'
copyright
=
u
'201
7
, Tiago de Paula Peixoto <tiago@skewed.de>'
copyright
=
u
'201
8
, Tiago de Paula Peixoto <tiago@skewed.de>'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
...
...
@@ -174,12 +174,12 @@ htmlhelp_basename = 'graph-tooldoc'
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping
=
{
'python'
:
(
'https://docs.python.org/3'
,
None
),
'numpy'
:
(
'http://docs.scipy.org/doc/numpy'
,
None
),
'scipy'
:
(
'http://docs.scipy.org/doc/scipy/reference'
,
None
),
'matplotlib'
:
(
'http://matplotlib.org'
,
None
),
'numpy'
:
(
'http
s
://docs.scipy.org/doc/numpy'
,
None
),
'scipy'
:
(
'http
s
://docs.scipy.org/doc/scipy/reference'
,
None
),
'matplotlib'
:
(
'http
s
://matplotlib.org'
,
None
),
'cairo'
:
(
'https://www.cairographics.org/documentation/pycairo/3'
,
None
),
'ipython'
:
(
'http://ipython.org/ipython-doc/stable/'
,
None
),
'panda'
:
(
'http://pandas.pydata.org/pandas-docs/stable/'
,
None
)}
'ipython'
:
(
'http
s
://ipython.org/ipython-doc/stable/'
,
None
),
'panda'
:
(
'http
s
://pandas.pydata.org/pandas-docs/stable/'
,
None
)}
extlinks_fancy
=
{
'ticket'
:
([
'https://graph-tool.skewed.de/tickets/ticket/{0}'
],
[
'ticket {0}'
]),
...
...
@@ -189,17 +189,6 @@ extlinks_fancy = {'ticket': (['https://graph-tool.skewed.de/tickets/ticket/{0}']
[
'DOI: {0}'
,
"sci-hub"
,
"@tor"
]),
'arxiv'
:
([
'https://arxiv.org/abs/{0}'
],
[
'arXiv: {0}'
])}
# def process_docstring(app, what, name, obj, options, lines):
# for i, line in enumerate(lines):
# if "arg1" in line and "->" in line:
# lines[i] = ""
# if "C++ signature :" in line or "graph_tool::Python" in line:
# lines[i] = ""
# def setup(app):
# app.connect('autodoc-process-docstring', process_docstring)
# plot directive
import
pyenv
plot_rcparams
=
pyenv
.
rcParams
...
...
@@ -220,3 +209,5 @@ def linkcode_resolve(domain, info):
return
None
modname
=
info
[
'module'
].
replace
(
'.'
,
'/'
)
return
"https://git.skewed.de/count0/graph-tool/tree/master/src/%s/__init__.py"
%
modname
nitpicky
=
True
doc/demos/inference/inference.rst
View file @
d70825df
...
...
@@ -229,8 +229,8 @@ Inferring the best partition
The simplest and most efficient approach is to find the best
partition of the network by maximizing Eq. :eq:`model-posterior`
according to some version of the model. This is obtained via the
functions :func:`~graph_tool.inference.minimize_blockmodel_dl` or
:func:`~graph_tool.inference.minimize_nested_blockmodel_dl`, which
functions :func:`~graph_tool.inference.minimize
.minimize
_blockmodel_dl` or
:func:`~graph_tool.inference.minimize
.minimize
_nested_blockmodel_dl`, which
employs an agglomerative multilevel `Markov chain Monte Carlo (MCMC)
<https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo>`_ algorithm
[peixoto-efficient-2014]_.
...
...
@@ -265,7 +265,7 @@ we then fit the degree-corrected model by calling
state = gt.minimize_blockmodel_dl(g)
This returns a :class:`~graph_tool.inference.BlockState` object that
This returns a :class:`~graph_tool.inference.
blockmodel.
BlockState` object that
includes the inference results.
.. note::
...
...
@@ -283,12 +283,12 @@ includes the inference results.
and select the partition with the largest posterior probability of
Eq. :eq:`model-posterior`, or equivalently, the minimum description
length of Eq. :eq:`model-dl`. The description length of a fit can be
obtained with the :meth:`~graph_tool.inference.BlockState.entropy`
obtained with the :meth:`~graph_tool.inference.
blockmodel.
BlockState.entropy`
method. See also Sec. :ref:`sec_model_selection` below.
We may perform a drawing of the partition obtained via the
:mod:`~graph_tool.inference.BlockState.draw` method, that functions as a
:mod:`~graph_tool.inference.
blockmodel.
BlockState.draw` method, that functions as a
convenience wrapper to the :func:`~graph_tool.draw.graph_draw` function
.. testcode:: football
...
...
@@ -307,7 +307,7 @@ which yields the following image.
We can obtain the group memberships as a
:class:`~graph_tool.PropertyMap` on the vertices via the
:mod:`~graph_tool.inference.BlockState.get_blocks` method:
:mod:`~graph_tool.inference.
blockmodel.
BlockState.get_blocks` method:
.. testcode:: football
...
...
@@ -322,7 +322,7 @@ which yields:
3
We may also access the matrix of edge counts between groups via
:mod:`~graph_tool.inference.BlockState.get_matrix`
:mod:`~graph_tool.inference.
blockmodel.
BlockState.get_matrix`
.. testcode:: football
...
...
@@ -353,7 +353,7 @@ Hierarchical partitions
The inference of the nested family of SBMs is done in a similar manner,
but we must use instead the
:func:`~graph_tool.inference.minimize_nested_blockmodel_dl` function. We
:func:`~graph_tool.inference.minimize
.minimize
_nested_blockmodel_dl` function. We
illustrate its use with the neural network of the `C. elegans
<https://en.wikipedia.org/wiki/Caenorhabditis_elegans>`_ worm:
...
...
@@ -379,10 +379,10 @@ A hierarchical fit of the degree-corrected model is performed as follows.
state = gt.minimize_nested_blockmodel_dl(g)
The object returned is an instance of a
:class:`~graph_tool.inference.NestedBlockState` class, which
:class:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState` class, which
encapsulates the results. We can again draw the resulting hierarchical
clustering using the
:meth:`~graph_tool.inference.NestedBlockState.draw` method:
:meth:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState.draw` method:
.. testcode:: celegans
...
...
@@ -397,12 +397,12 @@ clustering using the
.. note::
If the ``output`` parameter to
:meth:`~graph_tool.inference.NestedBlockState.draw` is omitted, an
:meth:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState.draw` is omitted, an
interactive visualization is performed, where the user can re-order
the hierarchy nodes using the mouse and pressing the ``r`` key.
A summary of the inferred hierarchy can be obtained with the
:meth:`~graph_tool.inference.NestedBlockState.print_summary` method,
:meth:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState.print_summary` method,
which shows the number of nodes and groups in all levels:
.. testcode:: celegans
...
...
@@ -417,8 +417,8 @@ which shows the number of nodes and groups in all levels:
l: 3, N: 3, B: 1
The hierarchical levels themselves are represented by individual
:meth:`~graph_tool.inference.BlockState` instances obtained via the
:meth:`~graph_tool.inference.NestedBlockState.get_levels()` method:
:meth:`~graph_tool.inference.
blockmodel.
BlockState` instances obtained via the
:meth:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState.get_levels()` method:
.. testcode:: celegans
...
...
@@ -456,8 +456,9 @@ Model selection
+++++++++++++++
As mentioned above, one can select the best model according to the
choice that yields the smallest description length. For instance, in
case of the `C. elegans` network we have
choice that yields the smallest description length
[peixoto-model-2016]_. For instance, in case of the `C. elegans` network
we have
.. testsetup:: model-selection
...
...
@@ -567,9 +568,9 @@ groups being used in the model, and hence is suitable for use on very
large networks.
In order to perform such moves, one needs again to operate with
:class:`~graph_tool.inference.BlockState` or
:class:`~graph_tool.inference.NestedBlockState` instances, and calling
their :meth:`~graph_tool.inference.BlockState.mcmc_sweep` methods. For
:class:`~graph_tool.inference.
blockmodel.
BlockState` or
:class:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState` instances, and calling
their :meth:`~graph_tool.inference.
blockmodel.
BlockState.mcmc_sweep` methods. For
example, the following will perform 1000 sweeps of the algorithm with
the network of characters in the novel Les Misérables, starting from a
random partition into 20 groups
...
...
@@ -603,10 +604,10 @@ random partition into 20 groups
Starting from a random partition is rarely the best option, since it
may take a long time for it to equilibrate. It was done above simply
as an illustration on how to initialize
:class:`~graph_tool.inference.BlockState` by hand. Instead, a much
:class:`~graph_tool.inference.
blockmodel.
BlockState` by hand. Instead, a much
better option in practice is to start from an approximation to the
"ground state" obtained with
:func:`~graph_tool.inference.minimize_blockmodel_dl`, e.g.
:func:`~graph_tool.inference.minimize
.minimize
_blockmodel_dl`, e.g.
.. testcode:: model-averaging
...
...
@@ -624,7 +625,7 @@ random partition into 20 groups
Although the above is sufficient to implement model averaging, there is a
convenience function called
:func:`~graph_tool.inference.mcmc_equilibrate` that is intend to
:func:`~graph_tool.inference.mcmc
.mcmc
_equilibrate` that is intend to
simplify the detection of equilibration, by keeping track of the maximum
and minimum values of description length encountered and how many sweeps
have been made without a "record breaking" event. For example,
...
...
@@ -691,14 +692,14 @@ Note that the value of ``wait`` above was made purposefully low so that
the output would not be overly long. The most appropriate value requires
experimentation, but a typically good value is ``wait=1000``.
The function :func:`~graph_tool.inference.mcmc_equilibrate` accepts a
The function :func:`~graph_tool.inference.mcmc
.mcmc
_equilibrate` accepts a
``callback`` argument that takes an optional function to be invoked
after each call to
:meth:`~graph_tool.inference.BlockState.mcmc_sweep`. This function
:meth:`~graph_tool.inference.
blockmodel.
BlockState.mcmc_sweep`. This function
should accept a single parameter which will contain the actual
:class:`~graph_tool.inference.BlockState` instance. We will use this in
:class:`~graph_tool.inference.
blockmodel.
BlockState` instance. We will use this in
the example below to collect the posterior vertex marginals (via
:class:`~graph_tool.inference.BlockState.collect_vertex_marginals`),
:class:`~graph_tool.inference.
blockmodel.
BlockState.collect_vertex_marginals`),
i.e. the posterior probability that a node belongs to a given group:
.. testcode:: model-averaging
...
...
@@ -775,11 +776,11 @@ Hierarchical partitions
We can also perform model averaging using the nested SBM, which will
give us a distribution over hierarchies. The whole procedure is fairly
analogous, but now we make use of
:class:`~graph_tool.inference.NestedBlockState` instances.
:class:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState` instances.
.. note::
When using :class:`~graph_tool.inference.NestedBlockState` instances
When using :class:`~graph_tool.inference.
nested_blockmodel.
NestedBlockState` instances
to perform model averaging, they need to be constructed with the
option ``sampling=True``.
...
...
@@ -820,7 +821,7 @@ network as above.
Number of accepted vertex moves: 56087
Similarly to the the non-nested case, we can use
:func:`~graph_tool.inference.mcmc_equilibrate` to do most of the boring
:func:`~graph_tool.inference.mcmc
.mcmc
_equilibrate` to do most of the boring
work, and we can now obtain vertex marginals on all hierarchical levels:
...
...
@@ -980,8 +981,8 @@ The computation of the posterior entropy :math:`\mathcal{S}`, however,
is significantly more difficult, since it involves measuring the precise
value of :math:`q(\boldsymbol b)`. A direct "brute force" computation of
:math:`\mathcal{S}` is implemented via
:meth:`~graph_tool.inference.BlockState.collect_partition_histogram` and
:func:`~graph_tool.inference.microstate_entropy`, however this is only
:meth:`~graph_tool.inference.
blockmodel.
BlockState.collect_partition_histogram` and
:func:`~graph_tool.inference.
blockmodel.
microstate_entropy`, however this is only
feasible for very small networks. For larger networks, we are forced to
perform approximations. The simplest is a "mean field" one, where we
assume the posterior factorizes as
...
...
@@ -1044,10 +1045,10 @@ whenever possible.
With these approximations, it possible to estimate the full model
evidence efficiently, as we show below, using
:meth:`~graph_tool.inference.BlockState.collect_vertex_marginals`,
:meth:`~graph_tool.inference.BlockState.collect_edge_marginals`,
:meth:`~graph_tool.inference.mf_entropy` and
:meth:`~graph_tool.inference.bethe_entropy`.
:meth:`~graph_tool.inference.
blockmodel.
BlockState.collect_vertex_marginals`,
:meth:`~graph_tool.inference.
blockmodel.
BlockState.collect_edge_marginals`,
:meth:`~graph_tool.inference.
blockmodel.
mf_entropy` and
:meth:`~graph_tool.inference.
blockmodel.
bethe_entropy`.
.. testcode:: model-evidence
...
...
@@ -1239,12 +1240,13 @@ and any of the other discrete distributions for the magnitude,
:math:`y_{ij} = \operatorname{abs}(x_{ij})`.
The support for weighted networks is activated by passing the parameters
``recs`` and ``rec_types`` to :class:`~graph_tool.inference.BlockState`
(or :class:`~graph_tool.inference.OverlapBlockState`), that specify the
edge covariates (an edge :class:`~graph_tool.PropertyMap`) and their
types (a string from the table above), respectively. Note that these
parameters expect *lists*, so that multiple edge weights can be used
simultaneously.
``recs`` and ``rec_types`` to
:class:`~graph_tool.inference.blockmodel.BlockState` (or
:class:`~graph_tool.inference.overlap_blockmodel.OverlapBlockState`),
that specify the edge covariates (an edge
:class:`~graph_tool.PropertyMap`) and their types (a string from the
table above), respectively. Note that these parameters expect *lists*,
so that multiple edge weights can be used simultaneously.
For example, let us consider a network of suspected terrorists involved
in the train bombing of Madrid on March 11, 2004
...
...
@@ -1438,19 +1440,20 @@ representing distinct types if interactions
[peixoto-inferring-2015]_. Extensions to the SBM may be defined for such
data, and they can be inferred using the exact same interface shown
above, except one should use the
:class:`~graph_tool.inference.LayeredBlockState` class, instead of
:class:`~graph_tool.inference.BlockState`. This class takes two
additional parameters: the ``ec`` parameter, that must correspond to an
edge :class:`~graph_tool.PropertyMap` with the layer/covariate values on
the edges, and the Boolean ``layers`` parameter, which if ``True``
:class:`~graph_tool.inference.layered_blockmodel.LayeredBlockState`
class, instead of
:class:`~graph_tool.inference.blockmodel.BlockState`. This class takes
two additional parameters: the ``ec`` parameter, that must correspond to
an edge :class:`~graph_tool.PropertyMap` with the layer/covariate values
on the edges, and the Boolean ``layers`` parameter, which if ``True``
specifies a layered model, otherwise one with categorical edge
covariates (not to be confused with the weighted models in
Sec. :ref:`weights`).
If we use :func:`~graph_tool.inference.minimize_blockmodel_dl`, this can
If we use :func:`~graph_tool.inference.minimize
.minimize
_blockmodel_dl`, this can
be achieved simply by passing the option ``layers=True`` as well as the
appropriate value of ``state_args``, which will be propagated to
:class:`~graph_tool.inference.LayeredBlockState`'
s
constructor
.
:class:`~graph_tool.inference.
layered_blockmodel.
LayeredBlockState`'
s
constructor
.
As
an
example
,
let
us
consider
a
social
network
of
tribes
,
where
two
types
of
interactions
were
recorded
,
amounting
to
either
friendship
or
...
...
@@ -1535,7 +1538,7 @@ which do not depend on the normalization constant.
The
values
:
math
:`
P
(\
delta
\
boldsymbol
G
|
\
boldsymbol
G
,
\
boldsymbol
b
)`
can
be
computed
with
:
meth
:`~
graph_tool
.
inference
.
BlockState
.
get_edges_prob
`.
Hence
,
we
can
:
meth
:`~
graph_tool
.
inference
.
blockmodel
.
BlockState
.
get_edges_prob
`.
Hence
,
we
can
compute
spurious
/
missing
edge
probabilities
just
as
if
we
were
collecting
marginal
distributions
when
doing
model
averaging
.
...
...
doc/inference.rst
View file @
d70825df
.. automodule:: graph_tool.inference
:no-undoc-members:
:
show-inheritance
:
:
no-members
:
..
.. testcode:: inference_detailed
...
...
@@ -24,3 +24,50 @@
:options: -ELLIPSIS, +NORMALIZE_WHITESPACE
OK
.. automodule:: graph_tool.inference.blockmodel
:no-undoc-members:
:show-inheritance:
.. autoclass:: graph_tool.inference.blockmodel.PartitionHist
.. autoclass:: graph_tool.inference.blockmodel.BlockPairHist
.. automodule:: graph_tool.inference.overlap_blockmodel
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.layered_blockmodel
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.nested_blockmodel
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.uncertain_blockmodel
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.mcmc
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.bisection
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.minimize
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.blockmodel_em
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.util
:no-undoc-members:
:show-inheritance:
.. automodule:: graph_tool.inference.modularity
:no-undoc-members:
:show-inheritance:
src/graph_tool/__init__.py
View file @
d70825df
...
...
@@ -703,7 +703,7 @@ class PropertyMap(object):
instead a :class:`~numpy.ma.MaskedArray` object is returned,
which contains only entries for vertices/edges which are not
filtered out. If there are no filters in place, a regular
:class:`
:class:`~graph_tool.PropertyArray`
`
is returned, which
:class:`~graph_tool.PropertyArray` is returned, which
is identical to the :attr:`~PropertyMap.a` attribute."""
)
def
get_2d_array
(
self
,
pos
):
...
...
@@ -3347,6 +3347,8 @@ Edge.__name__ = "Edge"
VertexBase
.
__doc__
=
Vertex
.
__doc__
VertexBase
.
out_neighbors
=
Vertex
.
out_neighbors
VertexBase
.
in_neighbors
=
Vertex
.
in_neighbors
VertexBase
.
out_edges
=
Vertex
.
out_edges
VertexBase
.
in_edges
=
Vertex
.
in_edges
VertexBase
.
all_edges
=
Vertex
.
all_edges
VertexBase
.
all_neighbors
=
Vertex
.
all_neighbors
VertexBase
.
in_degree
=
Vertex
.
in_degree
...
...
src/graph_tool/clustering/__init__.py
View file @
d70825df
...
...
@@ -523,6 +523,13 @@ def motif_significance(g, k, n_shuffles=100, p=1.0, motif_list=None,
11
>>> print(zscores)
[0.22728646681107012, 0.21409572051644973, 0.007022040788902111, 0.5872141967123348, -0.37770179603294357, -0.3484733504783734, 0.8861811801325502, -0.08, -0.2, -0.38, -0.2]
References
----------
.. [wernicke-efficient-2006] S. Wernicke, "Efficient detection of network
motifs", IEEE/ACM Transactions on Computational Biology and
Bioinformatics (TCBB), Volume 3, Issue 4, Pages 347-359, 2006.
:doi:`10.1109/TCBB.2006.51`
"""
s_ms
,
counts
=
motifs
(
g
,
k
,
p
,
motif_list
)
...
...
src/graph_tool/collection/__init__.py
View file @
d70825df
...
...
@@ -95,7 +95,7 @@ Examples
representing the neural network of C. Elegans.
Data compiled by D. Watts and S. Strogatz and
made available on the web `here
<http://cdg.columbia.edu/cdg/datasets>`_. Please
<http://cdg.columbia.edu/cdg/datasets>`_
_
. Please
cite D. J. Watts and S. H. Strogatz, Nature 393,
440-442 (1998). Original experimental data taken
from J. G. White, E. Southgate, J. N. Thompson,
...
...
@@ -179,7 +179,7 @@ Examples
Retrieved from `Mark Newman's website
<http://www-personal.umich.edu/~mejn/netdata/>`_,
with corrections by T. S. Evans, available
`here <http://figshare.com/articles/American_College_Football_Network_Files/93179>`_.
`here <http://figshare.com/articles/American_College_Football_Network_Files/93179>`_
_
.
hep-th 8361 15751 False High-energy theory collaborations: weighted
network of coauthorships between scientists
posting preprints on the High-Energy Theory
...
...
@@ -208,7 +208,7 @@ Examples
and experiment, as compiled by M. Newman in May
2006. A figure depicting the largest component
of this network can be found `here
<http://www-personal.umich.edu/~mejn/centrality/>`_.
<http://www-personal.umich.edu/~mejn/centrality/>`_
_
.
These data can be cited as M. E. J. Newman,
Phys. Rev. E 74, 036104 (2006). Retrieved from
`Mark Newman's website
...
...
@@ -243,7 +243,7 @@ Examples
Power Grid of the United States. Data compiled
by D. Watts and S. Strogatz and made available
on the web `here
<http://cdg.columbia.edu/cdg/datasets>`_. Please
<http://cdg.columbia.edu/cdg/datasets>`_
_
. Please
cite D. J. Watts and S. H. Strogatz, Nature 393,
440-442 (1998). Retrieved from `Mark Newman's
website
...
...
src/graph_tool/draw/__init__.py
View file @
d70825df
...
...
@@ -229,7 +229,7 @@ def fruchterman_reingold_layout(g, weight=None, a=None, r=1., scale=None,
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
weight : :class:`PropertyMap` (optional, default: ``None``)
weight : :class:`
~graph_tool.
PropertyMap` (optional, default: ``None``)
An edge property map with the respective weights.
a : float (optional, default: :math:`V`)
Attracting force between adjacent vertices.
...
...
@@ -248,7 +248,7 @@ def fruchterman_reingold_layout(g, weight=None, a=None, r=1., scale=None,
displacement at each iteration.
n_iter : int (optional, default: ``100``)
Total number of iterations.
pos : :class:`PropertyMap` (optional, default: ``None``)
pos : :class:`
~graph_tool.
PropertyMap` (optional, default: ``None``)
Vector vertex property maps where the coordinates should be stored. If
provided, this will also be used as the initial position of the
vertices.
...
...
src/graph_tool/draw/cairo_draw.py
View file @
d70825df
...
...
@@ -579,10 +579,10 @@ def cairo_draw(g, pos, cr, vprops=None, eprops=None, vorder=None, eorder=None,
If provided, defines the relative order in which the edges are drawn.
nodesfirst : bool (optional, default: ``False``)
If ``True``, the vertices are drawn first, otherwise the edges are.
vcmap : :class:`matplotlib.colors.Colormap` or tuple (optional, default: :
class:`
default_cm`)
vcmap : :class:`matplotlib.colors.Colormap` or tuple (optional, default: :
obj:`~graph_tool.draw.
default_cm`)
Vertex color map. Optionally, this may be a
(:class:`matplotlib.colors.Colormap`, alpha) tuple.
ecmap : :class:`matplotlib.colors.Colormap` or tuple (optional, default: :
class:`
default_cm`)
ecmap : :class:`matplotlib.colors.Colormap` or tuple (optional, default: :
obj:`~graph_tool.draw.
default_cm`)
Edge color map. Optionally, this may be a
(:class:`matplotlib.colors.Colormap`, alpha) tuple.
loop_angle : float or :class:`~graph_tool.PropertyMap` (optional, default: ``nan``)
...
...
@@ -1582,7 +1582,7 @@ def draw_hierarchy(state, pos=None, layout="radial", beta=0.8, node_weight=None,
Parameters
----------
state : :class:`~graph_tool.
community
.NestedBlockState`
state : :class:`~graph_tool.
inference.nested_blockmodel
.NestedBlockState`
Nested block state to be drawn.
pos : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
If supplied, this specifies a vertex property map with the positions of
...
...
src/graph_tool/draw/graphviz_draw.py
View file @
d70825df
...
...
@@ -224,11 +224,11 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
Drawing color for edges. If the valued supplied is a property map,
the values must be scalar types, whose color values are obtained from
the ``ecmap`` argument.
vcmap : :class:`matplotlib.colors.Colormap` (default: :
class
:`matplotlib.cm.jet`)
vcmap : :class:`matplotlib.colors.Colormap` (default: :
obj
:`matplotlib.cm.jet`)
Vertex color map.
vnorm : bool (default: ``True``)
Normalize vertex color values to the [0,1] range.
ecmap : :class:`matplotlib.colors.Colormap` (default: :
class
:`matplotlib.cm.jet`)
ecmap : :class:`matplotlib.colors.Colormap` (default: :
obj
:`matplotlib.cm.jet`)
Edge color map.
enorm : bool (default: ``True``)
Normalize edge color values to the [0,1] range.
...
...
src/graph_tool/inference/__init__.py
View file @
d70825df
...
...
@@ -39,8 +39,8 @@ High-level functions
.. autosummary::
:nosignatures:
minimize_blockmodel_dl
minimize_nested_blockmodel_dl
~graph_tool.inference.minimize.
minimize_blockmodel_dl
~graph_tool.inference.minimize.
minimize_nested_blockmodel_dl
State classes
=============
...
...
@@ -48,14 +48,11 @@ State classes
.. autosummary::
:nosignatures:
BlockState
OverlapBlockState
LayeredBlockState
NestedBlockState
UncertainBlockState
MeasuredBlockState
MixedMeasuredBlockState
TemperingState
~graph_tool.inference.blockmodel.BlockState
~graph_tool.inference.overlap_blockmodel.OverlapBlockState
~graph_tool.inference.layered_blockmodel.LayeredBlockState
~graph_tool.inference.nested_blockmodel.NestedBlockState
~graph_tool.inference.mcmc.TemperingState
Sampling and minimization
=========================
...
...
@@ -63,13 +60,13 @@ Sampling and minimization
.. autosummary::
:nosignatures:
mcmc_equilibrate
mcmc_anneal
mcmc_multilevel
multicanonical_equilibrate
MulticanonicalState
bisection_minimize
hierarchy_minimize
~graph_tool.inference.mcmc.
mcmc_equilibrate
~graph_tool.inference.mcmc.
mcmc_anneal
~graph_tool.inference.mcmc.
mcmc_multilevel
~graph_tool.inference.mcmc.
multicanonical_equilibrate
~graph_tool.inference.mcmc.
MulticanonicalState
~graph_tool.inference.bisection.
bisection_minimize
~graph_tool.inference.nested_blockmodel.
hierarchy_minimize
Auxiliary functions
===================
...
...
@@ -77,12 +74,12 @@ Auxiliary functions
.. autosummary::
:nosignatures:
model_entropy
mf_entropy
bethe_entropy
microstate_entropy
half_edge_graph
get_block_edge_gradient
~graph_tool.inference.blockmodel.
model_entropy
~graph_tool.inference.blockmodel.
mf_entropy
~graph_tool.inference.blockmodel.
bethe_entropy
~graph_tool.inference.blockmodel.
microstate_entropy
~graph_tool.inference.overlap_blockmodel.
half_edge_graph
~graph_tool.inference.overlap_blockmodel.
get_block_edge_gradient
Auxiliary classes
=================
...
...
@@ -90,9 +87,22 @@ Auxiliary classes
.. autosummary::
:nosignatures:
PartitionHist
BlockPairHist
UncertainBaseState
~graph_tool.inference.blockmodel.PartitionHist
~graph_tool.inference.blockmodel.BlockPairHist
Nonparametric network reconstruction
++++++++++++++++++++++++++++++++++++
State classes
=============
.. autosummary::
:nosignatures:
~graph_tool.inference.uncertain_blockmodel.MeasuredBlockState
~graph_tool.inference.uncertain_blockmodel.MixedMeasuredBlockState
~graph_tool.inference.uncertain_blockmodel.UncertainBlockState
~graph_tool.inference.uncertain_blockmodel.UncertainBaseState
Semiparametric stochastic block model inference
+++++++++++++++++++++++++++++++++++++++++++++++
...
...
@@ -103,7 +113,7 @@ State classes
.. autosummary::
:nosignatures:
EMBlockState
~graph_tool.inference.blockmodel_em.
EMBlockState
Expectation-maximization Inference
==================================
...
...
@@ -111,7 +121,7 @@ Expectation-maximization Inference
.. autosummary::
:nosignatures:
em_infer
~graph_tool.inference.blockmodel_em.
em_infer
Large-scale descriptors
+++++++++++++++++++++++
...
...
@@ -119,7 +129,7 @@ Large-scale descriptors
.. autosummary::
:nosignatures:
modularity
~graph_tool.inference.modularity.
modularity
Contents
++++++++
...
...
src/graph_tool/inference/bisection.py
View file @
d70825df
...
...
@@ -94,13 +94,13 @@ def bisection_minimize(init_states, random_bisection=False,
Parameters
----------
init_states : Any state class (e.g. :class:`~graph_tool.inference.BlockState`)
init_states : Any state class (e.g. :class:`~graph_tool.inference.
blockmodel.
BlockState`)
List with two or more states that will be used to bracket the search.
random_bisection : ``bool`` (optional, default: ``False``)
If ``True``, the bisection will be done randomly in the interval,
instead of using the golden rule.
mcmc_multilevel_args : ``dict`` (optional, default: ``{}``)
Arguments to be passed to :func:`~graph_tool.inference.mcmc_multilevel`.
Arguments to be passed to :func:`~graph_tool.inference.mcmc
.mcmc
_multilevel`.
verbose : ``bool`` or ``tuple`` (optional, default: ``False``)
If ``True``, progress information will be shown. Optionally, this
accepts arguments of the type ``tuple`` of the form ``(level, prefix)``
...
...
@@ -110,15 +110,16 @@ def bisection_minimize(init_states, random_bisection=False,
Returns
-------