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
3512df30
Commit
3512df30
authored
Apr 27, 2019
by
Tiago Peixoto
Browse files
Documentation improvements and fixes
parent
9d71c105
Changes
35
Hide whitespace changes
Inline
Side-by-side
doc/conf.py
View file @
3512df30
...
...
@@ -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://g
raph-tool
.skewed.de/
tickets/ticket
/{0}'
],
[
'
ticket
{0}'
]),
extlinks_fancy
=
{
'
issue
'
:
([
'https://g
it
.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}'
],
...
...
doc/demos/inference/_model_class_selection.rst
View file @
3512df30
...
...
@@ -219,8 +219,8 @@ approach for the same network, using the nested model.
.. testoutput:: model-evidence
Model evidence for deg_corr = True: -5
55.76807
0... (mean field), -
731.501041
... (Bethe)
Model evidence for deg_corr = False: -5
44.346500
... (mean field), -6
30.951518
... (Bethe)
Model evidence for deg_corr = True: -5
23.72236
0... (mean field), -
686.592569
... (Bethe)
Model evidence for deg_corr = False: -5
16.006708
... (mean field), -6
19.110456
... (Bethe)
The results are similar: If we consider the most accurate approximation,
the non-degree-corrected model possesses the largest evidence. Note also
...
...
doc/demos/inference/_prediction.rst
View file @
3512df30
...
...
@@ -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-consistenc
y
-201
7
]_
:math:`\delta \boldsymbol A` as [valles-catala-consistenc
ies
-201
8
]_
.. math::
:label: posterior-missing
...
...
doc/demos/inference/_reconstruction.rst
View file @
3512df30
...
...
@@ -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.8
41384
...
Posterior probability of non-edge (15, 73): 0.
100010
...
Estimated average local clustering: 0.57
1836
± 0.00
5152
...
Posterior probability of edge (11, 36): 0.8
90889
...
Posterior probability of non-edge (15, 73): 0.
056005
...
Estimated average local clustering: 0.57
2758
± 0.00
3998
...
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.5
93359
...
Posterior probability of non-edge (15, 73): 0.0
50705
...
Estimated average local clustering: 0.57
0958
± 0.00
6660
...
Posterior probability of edge (11, 36): 0.5
15651
...
Posterior probability of non-edge (15, 73): 0.0
09000
...
Estimated average local clustering: 0.57
1673
± 0.00
3228
...
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.9
48894
...
Posterior probability of non-edge (15, 73): 0.0
49004
...
Estimated average local clustering: 0.5
52446
± 0.01
9751
...
Posterior probability of edge (11, 36): 0.9
51195
...
Posterior probability of non-edge (15, 73): 0.0
20702
...
Estimated average local clustering: 0.5
38731
± 0.01
7645
...
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
doc/demos/inference/_reconstruction_dynamics.rst
0 → 100644
View file @
3512df30
.. _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)))
doc/demos/inference/_sampling.rst
View file @
3512df30
...
...
@@ -275,8 +275,8 @@ network as above.
.. testoutput:: nested-model-averaging
Change in description length:
20.22
31
1
5...
Number of accepted vertex moves: 5
8320
Change in description length:
15.48
31
3
5...
Number of accepted vertex moves: 5
7684
Similarly to the the non-nested case, we can use
:func:`~graph_tool.inference.mcmc.mcmc_equilibrate` to do most of the boring
...
...
doc/demos/inference/inference.rst
View file @
3512df30
...
...
@@ -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
...
...
doc/draw.rst
View file @
3512df30
.. 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:
doc/gt_theme/static/flasky.css
View file @
3512df30
...
...
@@ -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
;
...
...
doc/pyenv.py
View file @
3512df30
...
...
@@ -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
()
...
...
doc/quickstart.rst
View file @
3512df30
...
...
@@ -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
i
zip(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
i
zip(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
...
...
src/graph_tool/__init__.py
View file @
3512df30
...
...
@@ -1193,7 +1193,7 @@ def infect_vertex_property(g, prop, vals=None):
Parameters
----------
prop : :class:`~graph_tool.PropertyMap`
prop : :class:`~graph_tool.
Vertex
PropertyMap`
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.
Vertex
PropertyMap`
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.
Edge
PropertyMap` (optional, default: `None`)
If provided, the resulting edge properties will be stored here.
Returns
-------
eprop : :class:`~graph_tool.PropertyMap`
eprop : :class:`~graph_tool.
Edge
PropertyMap`
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.
Edge
PropertyMap`
Edge property map to be summed.
vprop : :class:`~graph_tool.PropertyMap` (optional, default: `None`)
vprop : :class:`~graph_tool.
Vertex
PropertyMap` (optional, default: `None`)
If provided, the resulting vertex properties will be stored here.
Returns
-------
vprop : :class:`~graph_tool.PropertyMap`
vprop : :class:`~graph_tool.
Vertex
PropertyMap`
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.
Vertex
PropertyMap` 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.
Edge
PropertyMap` ``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.
Edge
PropertyMap` ``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.
Vertex
PropertyMap`
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.
Edge
PropertyMap`
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.
Edge
PropertyMap`
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.
Edge
PropertyMap`, 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.
Edge
PropertyMap`, and the out-degree will
correspond to the sum of the weights of the out-edges.
"""
...
...
src/graph_tool/centrality/__init__.py
View file @
3512df30
...
...
@@ -69,12 +69,12 @@ def pagerank(g, damping=0.85, pers=None, weight=None, prop=None, epsilon=1e-6,
Graph to be used.
damping : float, optional (default: 0.85)
Damping factor.
pers : :class:`~graph_tool.PropertyMap`, optional (default: None)
pers : :class:`~graph_tool.
Vertex
PropertyMap`, optional (default: None)
Personalization vector. If omitted, a constant value of :math:`1/N`
will be used.
weight : :class:`~graph_tool.PropertyMap`, optional (default: None)
weight : :class:`~graph_tool.
Edge
PropertyMap`, optional (default: None)
Edge weights. If omitted, a constant value of 1 will be used.
prop : :class:`~graph_tool.PropertyMap`, optional (default: None)
prop : :class:`~graph_tool.
Vertex
PropertyMap`, optional (default: None)
Vertex property map to store the PageRank values. If supplied, it will
be used uninitialized.
epsilon : float, optional (default: 1e-6)
...
...
@@ -87,7 +87,7 @@ def pagerank(g, damping=0.85, pers=None, weight=None, prop=None, epsilon=1e-6,
Returns
-------
pagerank : :class:`~graph_tool.PropertyMap`
pagerank : :class:`~graph_tool.
Vertex
PropertyMap`
A vertex property map containing the PageRank values.
See Also
...
...
@@ -243,11 +243,11 @@ def betweenness(g, pivots=None, vprop=None, eprop=None, weight=None, norm=True):
this list as pivots. If the list contains all nodes (the default) the
algorithm will be exact, and if the vertices are randomly chosen the
result will be an unbiased estimator.
vprop : :class:`~graph_tool.PropertyMap`, optional (default: None)
vprop : :class:`~graph_tool.
Vertex
PropertyMap`, optional (default: None)
Vertex property map to store the vertex betweenness values.
eprop : :class:`~graph_tool.PropertyMap`, optional (default: None)
eprop : :class:`~graph_tool.
Edge
PropertyMap`, optional (default: None)
Edge property map to store the edge betweenness values.
weight : :class:`~graph_tool.PropertyMap`, optional (default: None)
weight : :class:`~graph_tool.
Edge
PropertyMap`, optional (default: None)
Edge property map corresponding to the weight value of each edge.
norm : bool, optional (default: True)
Whether or not the betweenness values should be normalized.
...
...
@@ -365,11 +365,11 @@ def closeness(g, weight=None, source=None, vprop=None, norm=True, harmonic=False
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
weight : :class:`~graph_tool.PropertyMap`, optional (default: None)
weight : :class:`~graph_tool.
Edge
PropertyMap`, optional (default: None)
Edge property map corresponding to the weight value of each edge.
source : :class:`~graph_tool.Vertex`, optional (default: ``None``)
If specified, the centrality is computed for this vertex alone.
vprop : :class:`~graph_tool.PropertyMap`, optional (default: ``None``)
vprop : :class:`~graph_tool.
Vertex
PropertyMap`, optional (default: ``None``)
Vertex property map to store the vertex centrality values.
norm : bool, optional (default: ``True``)
Whether or not the centrality values should be normalized.
...
...
@@ -379,7 +379,7 @@ def closeness(g, weight=None, source=None, vprop=None, norm=True, harmonic=False
Returns
-------
vertex_closeness : :class:`~graph_tool.PropertyMap`
vertex_closeness : :class:`~graph_tool.
Vertex
PropertyMap`
A vertex property map with the vertex closeness values.
See Also
...
...
@@ -491,15 +491,14 @@ def closeness(g, weight=None, source=None, vprop=None, norm=True, harmonic=False
def
central_point_dominance
(
g
,
betweenness
):
r
"""
Calculate the central point dominance of the graph, given the betweenness
r
"""Calculate the central point dominance of the graph, given the betweenness
centrality of each vertex.
Parameters
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
betweenness : :class:`~graph_tool.PropertyMap`
betweenness : :class:`~graph_tool.
Vertex
PropertyMap`