Commit 3512df30 authored by Tiago Peixoto's avatar Tiago Peixoto

Documentation improvements and fixes

parent 9d71c105
......@@ -184,8 +184,8 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'ipython': ('https://ipython.org/ipython-doc/stable/', None),
'panda': ('https://pandas.pydata.org/pandas-docs/stable/', None)}
extlinks_fancy = {'ticket': (['https://graph-tool.skewed.de/tickets/ticket/{0}'],
['ticket {0}']),
extlinks_fancy = {'issue': (['https://git.skewed.de/count0/graph-tool/issues/{0}'],
['issue #{0}']),
'doi': (['https://dx.doi.org/{0}',
'https://sci-hub.tw/{0}',
'https://scihub22266oqcxt.onion.link/{0}'],
......
......@@ -219,8 +219,8 @@ approach for the same network, using the nested model.
.. testoutput:: model-evidence
Model evidence for deg_corr = True: -555.768070... (mean field), -731.501041... (Bethe)
Model evidence for deg_corr = False: -544.346500... (mean field), -630.951518... (Bethe)
Model evidence for deg_corr = True: -523.722360... (mean field), -686.592569... (Bethe)
Model evidence for deg_corr = False: -516.006708... (mean field), -619.110456... (Bethe)
The results are similar: If we consider the most accurate approximation,
the non-degree-corrected model possesses the largest evidence. Note also
......
......@@ -21,7 +21,7 @@ We set up the classification task by dividing the edges/non-edges into
two sets :math:`\boldsymbol A` and :math:`\delta \boldsymbol A`, where
the former corresponds to the observed network and the latter either to
the missing or spurious edges. We may compute the posterior of
:math:`\delta \boldsymbol A` as [valles-catala-consistency-2017]_
:math:`\delta \boldsymbol A` as [valles-catala-consistencies-2018]_
.. math::
:label: posterior-missing
......
......@@ -5,11 +5,12 @@ An important application of generative models is to be able to
generalize from observations and make predictions that go beyond what is
seen in the data. This is particularly useful when the network we
observe is incomplete, or contains errors, i.e. some of the edges are
either missing or are outcomes of mistakes in measurement. In this
situation, we can use statistical inference to reconstruct the original
network. Following [peixoto-reconstructing-2018]_, if
:math:`\boldsymbol{\mathcal{D}}` is the observed data, the network can
be reconstructed according to the posterior distribution,
either missing or are outcomes of mistakes in measurement, or is not
even observed at all. In this situation, we can use statistical
inference to reconstruct the original network. Following
[peixoto-reconstructing-2018]_, if :math:`\boldsymbol{\mathcal{D}}` is
the observed data, the network can be reconstructed according to the
posterior distribution,
.. math::
......@@ -55,7 +56,7 @@ information and the uncertainty in the measurement data. Furthermore,
the use of the SBM means that the reconstruction can take advantage of
the *correlations* observed in the data to further inform it, which
generally can lead to substantial improvements
[peixoto-reconstructing-2018]_.
[peixoto-reconstructing-2018]_ [peixoto-network-2019]_.
In graph-tool there is support for reconstruction with the above
framework for three measurement processes: 1. Repeated measurements with
......@@ -67,6 +68,9 @@ and 3. Extraneously obtained edge probabilities (via
:class:`~graph_tool.inference.uncertain_blockmodel.UncertainBlockState`),
which we describe in the following.
In addition, it is also possible to reconstruct networks from observed
dynamical, as described in :ref:`reconstruction_dynamics`.
Measured networks
+++++++++++++++++
......@@ -185,9 +189,9 @@ Which yields the following output:
.. testoutput:: measured
Posterior probability of edge (11, 36): 0.841384...
Posterior probability of non-edge (15, 73): 0.100010...
Estimated average local clustering: 0.571836 ± 0.005152...
Posterior probability of edge (11, 36): 0.890889...
Posterior probability of non-edge (15, 73): 0.056005...
Estimated average local clustering: 0.572758 ± 0.003998...
We have a successful reconstruction, where both ambiguous adjacency
matrix entries are correctly recovered. The value for the average
......@@ -306,9 +310,9 @@ Which yields:
.. testoutput:: measured
Posterior probability of edge (11, 36): 0.593359...
Posterior probability of non-edge (15, 73): 0.050705...
Estimated average local clustering: 0.570958 ± 0.006660...
Posterior probability of edge (11, 36): 0.515651...
Posterior probability of non-edge (15, 73): 0.009000...
Estimated average local clustering: 0.571673 ± 0.003228...
The results are very similar to the ones obtained with the uniform model
in this case, but can be quite different in situations where a large
......@@ -434,9 +438,9 @@ The above yields the output:
.. testoutput:: uncertain
Posterior probability of edge (11, 36): 0.948894...
Posterior probability of non-edge (15, 73): 0.049004...
Estimated average local clustering: 0.552446 ± 0.019751...
Posterior probability of edge (11, 36): 0.951195...
Posterior probability of non-edge (15, 73): 0.020702...
Estimated average local clustering: 0.538731 ± 0.017645...
The reconstruction is accurate, despite the two ambiguous entries having
the same measurement probability. The reconstructed network is visualized below.
......@@ -480,3 +484,5 @@ the same measurement probability. The reconstructed network is visualized below.
ambiguity, both errors are successfully corrected by the
reconstruction. The pie fractions on the nodes correspond to the
probability of being in group associated with the respective color.
.. include:: _reconstruction_dynamics.rst
.. _reconstruction_dynamics:
Reconstruction from dynamics
++++++++++++++++++++++++++++
.. testsetup:: dynamics
import os
try:
os.chdir("demos/inference")
except FileNotFoundError:
pass
np.random.seed(42)
gt.seed_rng(44)
.. testcode:: dynamics
g = gt.collection.data["dolphins"]
ss = []
for i in range(1000):
si_state = gt.SIState(g, beta=1)
s = []
for j in range(10):
si_state.iterate_sync()
s.append(si_state.get_state().copy())
s = gt.group_vector_property(s)
ss.append(s)
u = g.copy()
u.clear_edges()
ss = [u.own_property(s) for s in ss]
rstate = gt.EpidemicsBlockState(u, s=ss, beta=None, r=1e-6, global_beta=.99,
state_args=dict(B=1), nested=False)
# Now we collect the marginals for exactly 100,000 sweeps, at
# intervals of 10 sweeps:
gm = None
bm = None
def collect_marginals(s):
global gm, bm
gm = s.collect_marginal(gm)
b = gt.perfect_prop_hash([s.bstate.b])[0]
bm = s.bstate.collect_vertex_marginals(bm, b=b)
gt.mcmc_equilibrate(rstate, force_niter=10000, mcmc_args=dict(niter=10, xstep=0, p=0, h=0),
callback=collect_marginals)
b = bm.new_vp("int", vals=[bm[v].a.argmax() for v in bm.vertices()])
graph_draw(gm, gm.own_property(g.vp.pos), vertex_shape="square", vertex_color="black",
vertex_fill_color=b, vertex_pen_width=1,
edge_pen_width=prop_to_size(gm.ep.eprob, 0, 5), eorder=gm.ep.eprob, output="dolphins")
eprob = u.ep.eprob
print("Posterior probability of edge (11, 36):", eprob[u.edge(11, 36)])
print("Posterior probability of non-edge (15, 73):", eprob[u.edge(15, 73)])
print("Estimated average local clustering: %g ± %g" % (np.mean(cs), np.std(cs)))
......@@ -275,8 +275,8 @@ network as above.
.. testoutput:: nested-model-averaging
Change in description length: 20.223115...
Number of accepted vertex moves: 58320
Change in description length: 15.483135...
Number of accepted vertex moves: 57684
Similarly to the the non-nested case, we can use
:func:`~graph_tool.inference.mcmc.mcmc_equilibrate` to do most of the boring
......
......@@ -73,7 +73,11 @@ References
:arxiv:`1310.4378`
.. [peixoto-reconstructing-2018] Tiago P. Peixoto, "Reconstructing
networks with unknown and heterogeneous errors", :arxiv:`1806.07956`
networks with unknown and heterogeneous errors", Phys. Rev. X 8
041011 (2018). :doi:`10.1103/PhysRevX.8.041011`, :arxiv:`1806.07956`
.. [peixoto-network-2019] Tiago P. Peixoto, "Network reconstruction and
community detection from dynamics", :arxiv:`1903.10833`
.. [martin-structural-2015] Travis Martin, Brian Ball, M. E. J. Newman,
"Structural inference for uncertain networks", Phys. Rev. E 93,
......@@ -88,13 +92,15 @@ References
spurious interactions and the reconstruction of complex networks", PNAS
vol. 106 no. 52 (2009). :doi:`10.1073/pnas.0908366106`
.. [valles-catala-consistency-2017] Toni Vallès-Català,
Tiago P. Peixoto, Roger Guimerà, Marta Sales-Pardo, "On the consistency
between model selection and link prediction in networks". :arxiv:`1705.07967`
.. [valles-catala-consistencies-2018] Toni Vallès-Català,
Tiago P. Peixoto, Roger Guimerà, Marta Sales-Pardo, "Consistencies
and inconsistencies between model selection and link prediction in
networks", Phys. Rev. E 97 062316 (2018),
:doi:`10.1103/PhysRevE.97.062316`, :arxiv:`1705.07967`
.. [mezard-information-2009] Marc Mézard, Andrea Montanari, "Information,
Physics, and Computation", Oxford Univ Press (2009).
:DOI:`10.1093/acprof:oso/9780198570837.001.0001`
:doi:`10.1093/acprof:oso/9780198570837.001.0001`
.. [guimera-modularity-2004] Roger Guimerà, Marta Sales-Pardo, and
Luís A. Nunes Amaral, "Modularity from fluctuations in random graphs
......
.. automodule:: graph_tool.draw
:no-members:
.. container:: sec_title
Layout algorithms
.. autofunction:: sfdp_layout
.. autofunction:: fruchterman_reingold_layout
.. autofunction:: arf_layout
.. autofunction:: radial_tree_layout
.. autofunction:: planar_layout
.. autofunction:: random_layout
.. container:: sec_title
Graph drawing
.. autofunction:: graph_draw
.. autofunction:: draw_hierarchy
.. autofunction:: graphviz_draw
.. autofunction:: prop_to_size
.. autofunction:: get_hierarchy_control_points
.. container:: sec_title
Low-level graph drawing
.. autofunction:: cairo_draw
.. autofunction:: interactive_window
.. autoclass:: GraphWidget
:show-inheritance:
:members:
:undoc-members:
.. autoclass:: GraphWindow
:show-inheritance:
:members:
:undoc-members:
:members:
:undoc-members:
:show-inheritance:
......@@ -392,13 +392,13 @@ ol.arabic li dl dt {
background-color: inherit;
}
.brackets:before {
content: "[";
}
/* .brackets:before { */
/* content: "["; */
/* } */
.brackets:after {
content: "]";
}
/* .brackets:after { */
/* content: "]"; */
/* } */
.fn-backref {
margin-right: 10px;
......
......@@ -47,6 +47,7 @@ import numpy as np
from pylab import *
from numpy import *
import graph_tool.all as gt
import graph_tool.draw
import random as prandom
figure()
......
......@@ -289,6 +289,24 @@ methods should be used:
for e in g.edges():
print(e)
.. testoutput::
:hide:
0
1
2
3
4
5
6
7
8
9
10
11
(0, 1)
(2, 3)
The code above will print the vertices and edges of the graph in the order they
are found.
......@@ -302,7 +320,6 @@ and :meth:`~graph_tool.Vertex.in_neighbors` methods, respectively.
.. testcode::
from itertools import izip
for v in g.vertices():
for e in v.out_edges():
print(e)
......@@ -310,9 +327,17 @@ and :meth:`~graph_tool.Vertex.in_neighbors` methods, respectively.
print(w)
# the edge and neighbors order always match
for e, w in izip(v.out_edges(), v.out_neighbors()):
for e, w in zip(v.out_edges(), v.out_neighbors()):
assert e.target() == w
.. testoutput::
:hide:
(0, 1)
1
(2, 3)
3
The code above will print the out-edges and out-neighbors of all
vertices in the graph.
......@@ -352,7 +377,7 @@ For example, using this interface we can get the out-degree of each node via:
.. testoutput::
[1 0 1 0 0 0 0 0 0 0 0 0]
[0 1 0 1 0 0 0 0 0 0 0 0]
or the sum of the product of the in and out-degrees of the endpoints of
each edge with:
......@@ -415,14 +440,13 @@ such:
.. testcode::
from itertools import izip
from numpy.random import randint
g = Graph()
g.add_vertex(100)
# insert some random links
for s,t in izip(randint(0, 100, 100), randint(0, 100, 100)):
for s,t in zip(randint(0, 100, 100), randint(0, 100, 100)):
g.add_edge(g.vertex(s), g.vertex(t))
vprop_double = g.new_vertex_property("double") # Double-precision floating point
......
......@@ -1193,7 +1193,7 @@ def infect_vertex_property(g, prop, vals=None):
Parameters
----------
prop : :class:`~graph_tool.PropertyMap`
prop : :class:`~graph_tool.VertexPropertyMap`
Property map to be modified.
vals : list (optional, default: `None`)
List of values to be propagated. If not provided, all values
......@@ -1225,17 +1225,17 @@ def edge_endpoint_property(g, prop, endpoint, eprop=None):
Parameters
----------
prop : :class:`~graph_tool.PropertyMap`
prop : :class:`~graph_tool.VertexPropertyMap`
Vertex property map to be used to propagated to the edge.
endpoint : `"source"` or `"target"`
Edge endpoint considered. If the graph is undirected, the source is
always the vertex with the lowest index.
eprop : :class:`~graph_tool.PropertyMap` (optional, default: `None`)
eprop : :class:`~graph_tool.EdgePropertyMap` (optional, default: `None`)
If provided, the resulting edge properties will be stored here.
Returns
-------
eprop : :class:`~graph_tool.PropertyMap`
eprop : :class:`~graph_tool.EdgePropertyMap`
Propagated edge property.
Examples
......@@ -1283,14 +1283,14 @@ def incident_edges_op(g, direction, op, eprop, vprop=None):
Direction of the incident edges.
op : `"sum"`, `"prod"`, `"min"` or `"max"`
Operation performed on incident edges.
eprop : :class:`~graph_tool.PropertyMap`
eprop : :class:`~graph_tool.EdgePropertyMap`
Edge property map to be summed.
vprop : :class:`~graph_tool.PropertyMap` (optional, default: `None`)
vprop : :class:`~graph_tool.VertexPropertyMap` (optional, default: `None`)
If provided, the resulting vertex properties will be stored here.
Returns
-------
vprop : :class:`~graph_tool.PropertyMap`
vprop : :class:`~graph_tool.VertexPropertyMap`
Resulting vertex property.
Examples
......@@ -1581,7 +1581,7 @@ class Graph(object):
filters, respectively.
If ``vorder`` is specified, it should correspond to a vertex
:class:`~graph_tool.PropertyMap` specifying the ordering of the vertices in
:class:`~graph_tool.VertexPropertyMap` specifying the ordering of the vertices in
the copied graph.
The graph is implemented as an `adjacency list`_, where both vertex and edge
......@@ -1842,7 +1842,7 @@ class Graph(object):
>>> g.add_vertex(5)
<...>
>>> g.get_vertices()
array([0, 1, 2, 3, 4], dtype=uint64)
array([0, 1, 2, 3, 4])
"""
vertices = libcore.get_vertex_list(self.__graph, 0,
......@@ -1949,9 +1949,9 @@ class Graph(object):
--------
>>> g = gt.random_graph(6, lambda: 1, directed=False)
>>> g.get_edges([g.edge_index])
array([[2, 1, 2],
[3, 4, 0],
[5, 0, 1]])
array([[0, 3, 2],
[1, 4, 1],
[2, 5, 0]])
"""
edges = libcore.get_edge_list(self.__graph, 0,
[ep._get_any() for ep in eprops])
......@@ -2038,8 +2038,7 @@ class Graph(object):
>>> g.get_in_edges(66, [g.edge_index])
array([[ 8687, 66, 179681],
[ 20369, 66, 255033],
[ 38674, 66, 300230]], dtype=uint64)
[ 38674, 66, 300230]])
"""
edges = libcore.get_in_edge_list(self.__graph, int(v),
[ep._get_any() for ep in eprops])
......@@ -2082,7 +2081,7 @@ class Graph(object):
>>> g.get_all_edges(66, [g.edge_index])
array([[ 8687, 66, 179681],
[ 20369, 66, 255033],
[ 38674, 66, 300230]], dtype=uint64)
[ 38674, 66, 300230]])
"""
edges = libcore.get_all_edge_list(self.__graph, int(v),
......@@ -2126,7 +2125,7 @@ class Graph(object):
--------
>>> g = gt.collection.data["pgp-strong-2009"]
>>> g.get_out_neighbors(66)
array([ 63, 20369, 13980, 8687, 38674], dtype=uint64)
array([ 63, 20369, 13980, 8687, 38674])
"""
vertices = libcore.get_out_neighbors_list(self.__graph, int(v),
......@@ -2175,7 +2174,7 @@ class Graph(object):
--------
>>> g = gt.collection.data["pgp-strong-2009"]
>>> g.get_in_neighbors(66)
array([ 8687, 20369, 38674], dtype=uint64)
array([ 8687, 20369, 38674])
"""
vertices = libcore.get_in_neighbors_list(self.__graph, int(v),
......@@ -2224,7 +2223,7 @@ class Graph(object):
--------
>>> g = gt.collection.data["pgp-strong-2009"]
>>> g.get_all_neighbors(66)
array([ 8687, 20369, 38674], dtype=uint64)
array([ 8687, 20369, 38674])
"""
vertices = libcore.get_all_neighbors_list(self.__graph, int(v),
......@@ -2240,13 +2239,13 @@ class Graph(object):
def get_out_degrees(self, vs, eweight=None):
"""Return a :class:`numpy.ndarray` containing the out-degrees of vertex list
``vs``. If supplied, the degrees will be weighted according to the edge
:class:`~graph_tool.PropertyMap` ``eweight``.
:class:`~graph_tool.EdgePropertyMap` ``eweight``.
Examples
--------
>>> g = gt.collection.data["pgp-strong-2009"]
>>> g.get_out_degrees([42, 666])
array([20, 38], dtype=uint64)
array([20, 38])
"""
return libcore.get_degree_list(self.__graph,
......@@ -2256,13 +2255,13 @@ class Graph(object):
def get_in_degrees(self, vs, eweight=None):
"""Return a :class:`numpy.ndarray` containing the in-degrees of vertex list
``vs``. If supplied, the degrees will be weighted according to the edge
:class:`~graph_tool.PropertyMap` ``eweight``.
:class:`~graph_tool.EdgePropertyMap` ``eweight``.
Examples
--------
>>> g = gt.collection.data["pgp-strong-2009"]
>>> g.get_in_degrees([42, 666])
array([20, 39], dtype=uint64)
array([20, 39])
"""
return libcore.get_degree_list(self.__graph,
......@@ -2571,7 +2570,7 @@ class Graph(object):
.. note::
Like :attr:`~graph_tool.Graph.edge_index`, this
is a special instance of a :class:`~graph_tool.PropertyMap`
is a special instance of a :class:`~graph_tool.VertexPropertyMap`
class, which is **immutable**, and cannot be
accessed as an array.""")
......@@ -2585,7 +2584,7 @@ class Graph(object):
.. note::
Like :attr:`~graph_tool.Graph.vertex_index`, this
is a special instance of a :class:`~graph_tool.PropertyMap`
is a special instance of a :class:`~graph_tool.EdgePropertyMap`
class, which is **immutable**, and cannot be
accessed as an array.
......@@ -2770,7 +2769,7 @@ class Graph(object):
def degree_property_map(self, deg, weight=None):
"""Create and return a vertex property map containing the degree type
given by ``deg``, which can be any of ``"in"``, ``"out"``, or ``"total"``.
If provided, ``weight`` should be an edge :class:`~graph_tool.PropertyMap`
If provided, ``weight`` should be an edge :class:`~graph_tool.EdgePropertyMap`
containing the edge weights which should be summed."""
pmap = self.__graph.degree_map(_to_str(deg), _prop("e", self, weight))
return VertexPropertyMap(pmap, self)
......@@ -3556,7 +3555,7 @@ def _all_neighbors(self):
def _in_degree(self, weight=None):
"""Return the in-degree of the vertex. If provided, ``weight`` should be a
scalar edge :class:`~graph_tool.PropertyMap`, and the in-degree will
scalar edge :class:`~graph_tool.EdgePropertyMap`, and the in-degree will
correspond to the sum of the weights of the in-edges.
"""
......@@ -3567,7 +3566,7 @@ def _in_degree(self, weight=None):
def _out_degree(self, weight=None):
"""Return the out-degree of the vertex. If provided, ``weight`` should be a
scalar edge :class:`~graph_tool.PropertyMap`, and the out-degree will
scalar edge :class:`~graph_tool.EdgePropertyMap`, and the out-degree will
correspond to the sum of the weights of the out-edges.
"""
......
This diff is collapsed.
......@@ -68,9 +68,9 @@ def local_clustering(g, weight=None, prop=None, undirected=True):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
weight : :class:`~graph_tool.PropertyMap`, optional (default: None)
weight : :class:`~graph_tool.EdgePropertyMap`, optional (default: None)
Edge weights. If omitted, a constant value of 1 will be used.
prop : :class:`~graph_tool.PropertyMap` or string, optional
prop : :class:`~graph_tool.VertexPropertyMap` or string, optional
Vertex property map where results will be stored. If specified, this
parameter will also be the return value.
undirected : bool (default: True)
......@@ -79,7 +79,7 @@ def local_clustering(g, weight=None, prop=None, undirected=True):
Returns
-------
prop : :class:`~graph_tool.PropertyMap`
prop : :class:`~graph_tool.VertexPropertyMap`
Vertex property containing the clustering coefficients.
See Also
......@@ -142,7 +142,7 @@ def global_clustering(g, weight=None):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
weight : :class:`~graph_tool.PropertyMap`, optional (default: None)
weight : :class:`~graph_tool.EdgePropertyMap`, optional (default: None)
Edge weights. If omitted, a constant value of 1 will be used.
Returns
......@@ -207,18 +207,18 @@ def extended_clustering(g, props=None, max_depth=3, undirected=False):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
props : list of :class:`~graph_tool.PropertyMap` objects, optional
props : list of :class:`~graph_tool.VertexPropertyMap` objects (optional, default: ``None``)
list of vertex property maps where results will be stored. If specified,
this parameter will also be the return value.
max_depth : int, optional
Maximum clustering order (default: 3).
undirected : bool, optional
max_depth : int (optional, default: ``3``)
Maximum clustering order.
undirected : boolean (optional, default: ``False``)
Calculate the *undirected* clustering coefficients, if graph is directed
(this option has no effect if the graph is undirected).
Returns
-------
prop : list of :class:`~graph_tool.PropertyMap` objects
prop : list of :class:`~graph_tool.VertexPropertyMap` objects
List of vertex properties containing the clustering coefficients.
See Also
......@@ -316,7 +316,7 @@ def motifs(g, k, p=1.0, motif_list=None, return_maps=False):
out-degree-sequence, and number of edges (in this order).
counts : list of ints
The number of times the respective motif in the motifs list was counted
vertex_maps : list of lists of :class:`~graph_tool.PropertyMap` objects
vertex_maps : list of lists of :class:`~graph_tool.VertexPropertyMap` objects
List for each motif graph containing the locations in the main
graph. This is only returned if `return_maps == True`.
......
......@@ -59,10 +59,10 @@ def assortativity(g, deg, eweight=None):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg : string or :class:`~graph_tool.PropertyMap`
deg : string or :class:`~graph_tool.VertexPropertyMap`
Degree type ("in", "out" or "total") or vertex property map, which
specifies the vertex types.
eweight : :class:`~graph_tool.PropertyMap` (optional, default: `None`)
eweight : :class:`~graph_tool.EdgePropertyMap` (optional, default: `None`)
If given, this will specify the edge weights, otherwise a constant value
of one will be used.
......@@ -128,10 +128,10 @@ def scalar_assortativity(g, deg, eweight=None):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg : string or :class:`~graph_tool.PropertyMap`
deg : string or :class:`~graph_tool.VertexPropertyMap`
Degree type ("in", "out" or "total") or vertex property map, which
specifies the vertex scalar values.
eweight : :class:`~graph_tool.PropertyMap` (optional, default: `None`)
eweight : :class:`~graph_tool.EdgePropertyMap` (optional, default: `None`)
If given, this will specify the edge weights, otherwise a constant value
of one will be used.
......@@ -196,10 +196,10 @@ def corr_hist(g, deg_source, deg_target, bins=[[0, 1], [0, 1]], weight=None,
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg_source : string or :class:`~graph_tool.PropertyMap`
deg_source : string or :class:`~graph_tool.VertexPropertyMap`
degree type ("in", "out" or "total") or vertex property map for the
source vertex.
deg_target : string or :class:`~graph_tool.PropertyMap`
deg_target : string or :class:`~graph_tool.VertexPropertyMap`
degree type ("in", "out" or "total") or vertex property map for the
target vertex.
bins : list of lists (optional, default: [[0, 1], [0, 1]])
......@@ -304,9 +304,9 @@ def combined_corr_hist(g, deg1, deg2, bins=[[0, 1], [0, 1]], float_count=True):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg1 : string or :class:`~graph_tool.PropertyMap`
deg1 : string or :class:`~graph_tool.VertexPropertyMap`
first degree type ("in", "out" or "total") or vertex property map.
deg2 : string or :class:`~graph_tool.PropertyMap`
deg2 : string or :class:`~graph_tool.VertexPropertyMap`
second degree type ("in", "out" or "total") or vertex property map.
bins : list of lists (optional, default: [[0, 1], [0, 1]])
A list of bin edges to be used for the first and second degrees. If any
......@@ -401,10 +401,10 @@ def avg_neighbor_corr(g, deg_source, deg_target, bins=[0, 1], weight=None):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg_source : string or :class:`~graph_tool.PropertyMap`
deg_source : string or :class:`~graph_tool.VertexPropertyMap`
degree type ("in", "out" or "total") or vertex property map for the
source vertex.
deg_target : string or :class:`~graph_tool.PropertyMap`
deg_target : string or :class:`~graph_tool.VertexPropertyMap`
degree type ("in", "out" or "total") or vertex property map for the
target vertex.
bins : list (optional, default: [0, 1])
......@@ -502,9 +502,9 @@ def avg_combined_corr(g, deg1, deg2, bins=[0, 1]):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
deg1 : string or :class:`~graph_tool.PropertyMap`
deg1 : string or :class:`~graph_tool.VertexPropertyMap`
first degree type ("in", "out" or "total") or vertex property map.
deg2 : string or :class:`~graph_tool.PropertyMap`
deg2 : string or :class:`~graph_tool.VertexPropertyMap`
second degree type ("in", "out" or "total") or vertex property map.
bins : list (optional, default: [0, 1])
Bins to be used for the first degrees. If the list has size 2, it is
......
......@@ -37,7 +37,6 @@ Layout algorithms
radial_tree_layout
planar_layout
random_layout
get_hierarchy_control_points
Graph drawing
=============
......@@ -49,6 +48,7 @@ Graph drawing
draw_hierarchy
graphviz_draw
prop_to_size
get_hierarchy_control_points
Low-level graph drawing
......@@ -101,14 +101,14 @@ def random_layout(g, shape=None, pos=None, dim=2):
match `dim`, and each element can be either a pair specifying a range,
or a single value specifying a range starting from zero. If None is
passed, a square of linear size :math:`\sqrt{N}` is used.
pos : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
pos : :class:`~graph_tool.VertexPropertyMap` (optional, default: ``None``)
Vector vertex property maps where the coordinates should be stored.
dim : int (optional, default: ``2``)
Number of coordinates per vertex.
Returns
-------
pos : :class:`~graph_tool.PropertyMap`
pos : :class:`~graph_tool.VertexPropertyMap`
A vector-valued vertex property map with the coordinates of the
vertices.
......@@ -165,12 +165,12 @@ def planar_layout(g, pos=None):
----------
g : :class:`~graph_tool.Graph`
Planar graph to be used.
pos : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
pos : :class:`~graph_tool.VertexPropertyMap` (optional, default: ``None``)
Vector vertex property maps where the coordinates should be stored.
Returns
-------
pos : :class:`~graph_tool.PropertyMap`
pos : :class:`~graph_tool.VertexPropertyMap`
A vector-valued vertex property map with the coordinates of the
vertices.
......@@ -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:`~graph_tool.PropertyMap` (optional, default: ``None``)
weight : :class:`~graph_tool.EdgePropertyMap` (optional, default: ``None``)
An edge property map with the respective weights.
a : float (optional, default: :math:`V`)
Attracting force between adjacent vertices.
......@@ -248,14 +248,14 @@ 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.