Commit fda2eafd authored by Tiago Peixoto's avatar Tiago Peixoto

planted_partition: update docstrings and add convenience methods

parent f9684ed2
......@@ -82,6 +82,9 @@ References
.. [peixoto-revealing-2020] Tiago P. Peixoto, "Revealing consensus and
dissensus between network partitions", :arxiv:`2005.13977`
.. [lizhi-statistical-2020] Lizhi Zhang, Tiago P. Peixoto, "Statistical
inference of assortative community structures", :arxiv:`2006.14493`
.. [peixoto-reconstructing-2018] Tiago P. Peixoto, "Reconstructing
networks with unknown and heterogeneous errors", Phys. Rev. X 8
041011 (2018). :doi:`10.1103/PhysRevX.8.041011`, :arxiv:`1806.07956`
......
......@@ -62,6 +62,12 @@ class PPBlockState(object):
b : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
Initial partition. If not supplied, a partition into a single group will
be used.
References
----------
.. [lizhi-statistical-2020] Lizhi Zhang, Tiago P. Peixoto, "Statistical
inference of assortative community structures", :arxiv:`2006.14493`
"""
def __init__(self, g, b=None):
......@@ -112,6 +118,14 @@ class PPBlockState(object):
return "<PPBlockState object with %d blocks, for graph %s, at 0x%x>" % \
(self.get_B(), str(self.g), id(self))
def get_blocks(self):
r"""Returns the property map which contains the block labels for each vertex."""
return self.b
def get_state(self):
"""Alias to :meth:`~PPBlockState.get_blocks`."""
return self.get_blocks()
def get_B(self):
r"Returns the total number of blocks."
return len(np.unique(self.b.fa))
......@@ -209,6 +223,10 @@ class PPBlockState(object):
For the partition prior :math:`P(\boldsymbol{b})` please refer to
:func:`~graph_tool.inference.blockmodel.model_entropy`.
References
----------
.. [lizhi-statistical-2020] Lizhi Zhang, Tiago P. Peixoto, "Statistical
inference of assortative community structures", :arxiv:`2006.14493`
"""
entropy_args = dict(self._entropy_args, **locals())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment