Commit 448a914b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

More documentation fixes.

parent 61d8cebd
.. automodule:: graph_tool.draw .. automodule:: graph_tool.draw
:no-members:
Layout algorithms Layout algorithms
================= =================
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<!-- property keys --> <!-- property keys -->
<key id="key0" for="node" attr.name="name" attr.type="string" /> <key id="key0" for="node" attr.name="name" attr.type="string" />
<key id="key1" for="edge" attr.name="weight" attr.type="float" /> <key id="key1" for="node" attr.name="pos" attr.type="vector_float" />
<key id="key2" for="edge" attr.name="weight" attr.type="float" />
<graph id="G" edgedefault="undirected" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst"> <graph id="G" edgedefault="undirected" parse.nodeids="canonical" parse.edgeids="canonical" parse.order="nodesfirst">
...@@ -14,86 +15,96 @@ ...@@ -14,86 +15,96 @@
<!-- vertices --> <!-- vertices -->
<node id="n0"> <node id="n0">
<data key="key0">Bob</data> <data key="key0">Bob</data>
<data key="key1">-0x1.ef066a9bc7566p+8, -0x1.8cba14a4daf9ep+8</data>
</node> </node>
<node id="n1"> <node id="n1">
<data key="key0">Alice</data> <data key="key0">Alice</data>
<data key="key1">-0x1.eff87ddcb5dcdp+8, -0x1.8be648e13bf73p+8</data>
</node> </node>
<node id="n2"> <node id="n2">
<data key="key0">Carol</data> <data key="key0">Carol</data>
<data key="key1">-0x1.eec36defefc65p+8, -0x1.8bfb011626325p+8</data>
</node> </node>
<node id="n3"> <node id="n3">
<data key="key0">Carlos</data> <data key="key0">Carlos</data>
<data key="key1">-0x1.ef434147d196bp+8, -0x1.8bf303e0a8156p+8</data>
</node> </node>
<node id="n4"> <node id="n4">
<data key="key0">Chuck</data> <data key="key0">Chuck</data>
<data key="key1">-0x1.ee23a5c21581dp+8, -0x1.8c946519352c7p+8</data>
</node> </node>
<node id="n5"> <node id="n5">
<data key="key0">Dave</data> <data key="key0">Dave</data>
<data key="key1">-0x1.f07f37873d595p+8, -0x1.8b75d14dbc907p+8</data>
</node> </node>
<node id="n6"> <node id="n6">
<data key="key0">Eve</data> <data key="key0">Eve</data>
<data key="key1">-0x1.ee9849cf138ffp+8, -0x1.8c6143c2dad9p+8</data>
</node> </node>
<node id="n7"> <node id="n7">
<data key="key0">Isaac</data> <data key="key0">Isaac</data>
<data key="key1">-0x1.ee7057c39cfedp+8, -0x1.8cf90ebb37008p+8</data>
</node> </node>
<node id="n8"> <node id="n8">
<data key="key0">Oscar</data> <data key="key0">Oscar</data>
<data key="key1">-0x1.f0a22f1b03f88p+8, -0x1.8c165cbc20962p+8</data>
</node> </node>
<node id="n9"> <node id="n9">
<data key="key0">Imothep</data> <data key="key0">Imothep</data>
<data key="key1">-0x1.ee3d366d42ab8p+8, -0x1.8b9e54a9a27b3p+8</data>
</node> </node>
<!-- edges --> <!-- edges -->
<edge id="e0" source="n0" target="n6"> <edge id="e0" source="n0" target="n6">
<data key="key1">0x1.9e7393907213cp+1</data> <data key="key2">0x1.9e7393907213cp+1</data>
</edge> </edge>
<edge id="e1" source="n0" target="n4"> <edge id="e1" source="n0" target="n4">
<data key="key1">0x1.015b0db294a3dp+2</data> <data key="key2">0x1.015b0db294a3dp+2</data>
</edge> </edge>
<edge id="e2" source="n0" target="n3"> <edge id="e2" source="n0" target="n3">
<data key="key1">0x1.12bcc343cdc2ap+2</data> <data key="key2">0x1.12bcc343cdc2ap+2</data>
</edge> </edge>
<edge id="e3" source="n0" target="n7"> <edge id="e3" source="n0" target="n7">
<data key="key1">0x1.ba3952afb7e9ep+1</data> <data key="key2">0x1.ba3952afb7e9ep+1</data>
</edge> </edge>
<edge id="e4" source="n1" target="n8"> <edge id="e4" source="n1" target="n8">
<data key="key1">0x1.0ff8065948f03p+1</data> <data key="key2">0x1.0ff8065948f03p+1</data>
</edge> </edge>
<edge id="e5" source="n1" target="n5"> <edge id="e5" source="n1" target="n5">
<data key="key1">0x1.a872068a0a4e5p+1</data> <data key="key2">0x1.a872068a0a4e5p+1</data>
</edge> </edge>
<edge id="e6" source="n1" target="n3"> <edge id="e6" source="n1" target="n3">
<data key="key1">0x1.2816bc78b034fp+2</data> <data key="key2">0x1.2816bc78b034fp+2</data>
</edge> </edge>
<edge id="e7" source="n2" target="n6"> <edge id="e7" source="n2" target="n6">
<data key="key1">0x1.82250c1278b54p+2</data> <data key="key2">0x1.82250c1278b54p+2</data>
</edge> </edge>
<edge id="e8" source="n2" target="n9"> <edge id="e8" source="n2" target="n9">
<data key="key1">0x1.8bb78dae3ee5ap+0</data> <data key="key2">0x1.8bb78dae3ee5ap+0</data>
</edge> </edge>
<edge id="e9" source="n3" target="n6"> <edge id="e9" source="n3" target="n6">
<data key="key1">0x1.587ad2707187fp+2</data> <data key="key2">0x1.587ad2707187fp+2</data>
</edge> </edge>
<edge id="e10" source="n3" target="n9"> <edge id="e10" source="n3" target="n9">
<data key="key1">0x1.7df6a3095905ep+2</data> <data key="key2">0x1.7df6a3095905ep+2</data>
</edge> </edge>
<edge id="e11" source="n4" target="n6"> <edge id="e11" source="n4" target="n6">
<data key="key1">0x1.62ac71123a64ap+0</data> <data key="key2">0x1.62ac71123a64ap+0</data>
</edge> </edge>
<edge id="e12" source="n4" target="n7"> <edge id="e12" source="n4" target="n7">
<data key="key1">0x1.2c156b7e6a49p+1</data> <data key="key2">0x1.2c156b7e6a49p+1</data>
</edge> </edge>
<edge id="e13" source="n4" target="n9"> <edge id="e13" source="n4" target="n9">
<data key="key1">0x1.543c16e43a9bfp+2</data> <data key="key2">0x1.543c16e43a9bfp+2</data>
</edge> </edge>
<edge id="e14" source="n5" target="n8"> <edge id="e14" source="n5" target="n8">
<data key="key1">0x1.5a4ab7454f0e2p+1</data> <data key="key2">0x1.5a4ab7454f0e2p+1</data>
</edge> </edge>
<edge id="e15" source="n6" target="n7"> <edge id="e15" source="n6" target="n7">
<data key="key1">0x1.841d9db6417f3p+1</data> <data key="key2">0x1.841d9db6417f3p+1</data>
</edge> </edge>
<edge id="e16" source="n6" target="n9"> <edge id="e16" source="n6" target="n9">
<data key="key1">0x1.20af02e97ed9ep+2</data> <data key="key2">0x1.20af02e97ed9ep+2</data>
</edge> </edge>
</graph> </graph>
......
...@@ -601,9 +601,9 @@ def model_entropy(B, N, E, directed=False, nr=None): ...@@ -601,9 +601,9 @@ def model_entropy(B, N, E, directed=False, nr=None):
References References
---------- ----------
.. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks",
Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`.
.. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures and high-resolution .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures and high-resolution
model selection in large networks ", :arxiv:`1310.4377`. model selection in large networks ", :arxiv:`1310.4377`.
""" """
...@@ -647,8 +647,8 @@ def get_max_B(N, E, directed=False): ...@@ -647,8 +647,8 @@ def get_max_B(N, E, directed=False):
References References
---------- ----------
.. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks",
Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`.
""" """
...@@ -698,8 +698,8 @@ def get_akc(B, I, N=float("inf"), directed=False): ...@@ -698,8 +698,8 @@ def get_akc(B, I, N=float("inf"), directed=False):
References References
---------- ----------
.. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks",
Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`.
""" """
if N != float("inf"): if N != float("inf"):
...@@ -746,7 +746,7 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False, ...@@ -746,7 +746,7 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False,
random order. Otherwise a total of `N` moves attempts are made, where random order. Otherwise a total of `N` moves attempts are made, where
`N` is the number of vertices, where each vertex can be selected with `N` is the number of vertices, where each vertex can be selected with
equal probability. equal probability.
vertices: ``list of ints`` (optional, default: ``None``) vertices : ``list of ints`` (optional, default: ``None``)
A list of vertices which will be attempted to be moved. If ``None``, all A list of vertices which will be attempted to be moved. If ``None``, all
vertices will be attempted. vertices will be attempted.
verbose : ``bool`` (optional, default: ``False``) verbose : ``bool`` (optional, default: ``False``)
...@@ -798,7 +798,7 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False, ...@@ -798,7 +798,7 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False,
the Markov chain by proposing membership moves :math:`r\to s` with the Markov chain by proposing membership moves :math:`r\to s` with
probability :math:`p(r\to s|t) \propto e_{ts} + c`, where :math:`t` is the probability :math:`p(r\to s|t) \propto e_{ts} + c`, where :math:`t` is the
block label of a random neighbour of the vertex being moved. See block label of a random neighbour of the vertex being moved. See
[peixoto-efficient-2014]_ for more details. [peixoto-efficient-2013]_ for more details.
This algorithm has a complexity of :math:`O(E)`, where :math:`E` is the This algorithm has a complexity of :math:`O(E)`, where :math:`E` is the
number of edges in the network. number of edges in the network.
...@@ -847,9 +847,9 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False, ...@@ -847,9 +847,9 @@ def mcmc_sweep(state, beta=1., random_move=False, c=1., dense=False,
.. [peixoto-entropy-2012] Tiago P. Peixoto "Entropy of Stochastic Blockmodel .. [peixoto-entropy-2012] Tiago P. Peixoto "Entropy of Stochastic Blockmodel
Ensembles." Physical Review E 85, no. 5 (2012): 056122. :doi:`10.1103/PhysRevE.85.056122`, Ensembles." Physical Review E 85, no. 5 (2012): 056122. :doi:`10.1103/PhysRevE.85.056122`,
:arxiv:`1112.6028`. :arxiv:`1112.6028`.
.. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks",
Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`.
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
""" """
...@@ -1016,9 +1016,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0, ...@@ -1016,9 +1016,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0,
random_move=False, c=1., dense=False, multigraph=False, random_move=False, c=1., dense=False, multigraph=False,
sequential=True, checkpoint=None, sequential=True, checkpoint=None,
minimize_state=None, verbose=False): minimize_state=None, verbose=False):
r"""Performs an agglomerative heuristic, which progressively merges blocks r"""Performs an agglomerative heuristic, which progressively merges blocks together (while allowing individual node moves) to achieve a good partition in ``B`` blocks.
together (while allowing individual node moves) to achieve a good partition
in ``B`` blocks.
Parameters Parameters
---------- ----------
...@@ -1115,7 +1113,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0, ...@@ -1115,7 +1113,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0,
This algorithm performs an agglomerative heuristic on the current block state, This algorithm performs an agglomerative heuristic on the current block state,
where blocks are progressively merged together, using repeated applications of where blocks are progressively merged together, using repeated applications of
the :func:`mcmc_sweep` moves, at different scales. See [peixoto-efficient-2014]_ the :func:`mcmc_sweep` moves, at different scales. See [peixoto-efficient-2013]_
for more details. for more details.
This algorithm has a complexity of :math:`O(N\ln^2 N)`, where :math:`N` is the This algorithm has a complexity of :math:`O(N\ln^2 N)`, where :math:`N` is the
...@@ -1149,7 +1147,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0, ...@@ -1149,7 +1147,7 @@ def multilevel_minimize(state, B, nsweeps=10, adaptive_sweeps=True, epsilon=0,
References References
---------- ----------
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
""" """
...@@ -1614,7 +1612,7 @@ def minimize_blockmodel_dl(g, eweight=None, vweight=None, deg_corr=True, dense=F ...@@ -1614,7 +1612,7 @@ def minimize_blockmodel_dl(g, eweight=None, vweight=None, deg_corr=True, dense=F
specific values of :math:`B` via :func:`mcmc_sweep` (with :math:`\beta = 1` specific values of :math:`B` via :func:`mcmc_sweep` (with :math:`\beta = 1`
and :math:`\beta\to\infty`), and minimizing :math:`\Sigma_{t/c}` via an and :math:`\beta\to\infty`), and minimizing :math:`\Sigma_{t/c}` via an
one-dimensional Fibonacci search on :math:`B`. See one-dimensional Fibonacci search on :math:`B`. See
[peixoto-parsimonious-2014]_ for more details. [peixoto-parsimonious-2013]_ for more details.
This algorithm has a complexity of :math:`O(\tau N\ln^2 B_{\text{max}})`, This algorithm has a complexity of :math:`O(\tau N\ln^2 B_{\text{max}})`,
where :math:`N` is the number of nodes in the network, :math:`\tau` is the where :math:`N` is the number of nodes in the network, :math:`\tau` is the
...@@ -1663,9 +1661,9 @@ def minimize_blockmodel_dl(g, eweight=None, vweight=None, deg_corr=True, dense=F ...@@ -1663,9 +1661,9 @@ def minimize_blockmodel_dl(g, eweight=None, vweight=None, deg_corr=True, dense=F
.. [peixoto-entropy-2012] Tiago P. Peixoto "Entropy of Stochastic Blockmodel .. [peixoto-entropy-2012] Tiago P. Peixoto "Entropy of Stochastic Blockmodel
Ensembles." Physical Review E 85, no. 5 (2012): 056122. :doi:`10.1103/PhysRevE.85.056122`, Ensembles." Physical Review E 85, no. 5 (2012): 056122. :doi:`10.1103/PhysRevE.85.056122`,
:arxiv:`1112.6028`. :arxiv:`1112.6028`.
.. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks",
Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`.
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
""" """
......
...@@ -333,9 +333,9 @@ def nested_mcmc_sweep(state, beta=1., random_move=False, c=1., sequential=True, ...@@ -333,9 +333,9 @@ def nested_mcmc_sweep(state, beta=1., random_move=False, c=1., sequential=True,
References References
---------- ----------
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
.. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures and high-resolution .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures and high-resolution
model selection in large networks ", :arxiv:`1310.4377`. model selection in large networks ", :arxiv:`1310.4377`.
""" """
...@@ -576,9 +576,9 @@ def nested_tree_sweep(state, nsweeps=10, epsilon=0., r=2., ...@@ -576,9 +576,9 @@ def nested_tree_sweep(state, nsweeps=10, epsilon=0., r=2.,
References References
---------- ----------
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
.. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures
and high-resolution model selection in large networks ", :arxiv:`1310.4377`. and high-resolution model selection in large networks ", :arxiv:`1310.4377`.
""" """
...@@ -811,9 +811,9 @@ def init_nested_state(g, Bs, deg_corr=True, dense=False, ...@@ -811,9 +811,9 @@ def init_nested_state(g, Bs, deg_corr=True, dense=False,
References References
---------- ----------
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
.. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures
and high-resolution model selection in large networks ", :arxiv:`1310.4377`. and high-resolution model selection in large networks ", :arxiv:`1310.4377`.
""" """
...@@ -999,7 +999,7 @@ def minimize_nested_blockmodel_dl(g, Bs=None, bs=None, deg_corr=True, ...@@ -999,7 +999,7 @@ def minimize_nested_blockmodel_dl(g, Bs=None, bs=None, deg_corr=True,
\mathcal{L}^l_t = \ln\left(\!\!{B_l\choose B_{l-1}}\!\!\right) + \ln B_{l-1}! - \sum_r \ln n_r^l!. \mathcal{L}^l_t = \ln\left(\!\!{B_l\choose B_{l-1}}\!\!\right) + \ln B_{l-1}! - \sum_r \ln n_r^l!.
See [peixoto-hierarchical-2014]_ for details on the algorithm. See [peixoto-hierarchical-2013]_ for details on the algorithm.
This algorithm has a complexity of :math:`O(N \ln^2 N)`, where :math:`N` This algorithm has a complexity of :math:`O(N \ln^2 N)`, where :math:`N`
is the number of nodes in the network. is the number of nodes in the network.
...@@ -1037,9 +1037,9 @@ def minimize_nested_blockmodel_dl(g, Bs=None, bs=None, deg_corr=True, ...@@ -1037,9 +1037,9 @@ def minimize_nested_blockmodel_dl(g, Bs=None, bs=None, deg_corr=True,
References References
---------- ----------
.. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures and high-resolution .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures and high-resolution
model selection in large networks ", :arxiv:`1310.4377`. model selection in large networks ", :arxiv:`1310.4377`.
.. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy
heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. heuristic for the inference of stochastic block models", :arxiv:`1310.4378`.
""" """
......
...@@ -1019,8 +1019,7 @@ def transform_scale(M, scale): ...@@ -1019,8 +1019,7 @@ def transform_scale(M, scale):
return np.sqrt(p[0] ** 2 + p[1] ** 2) return np.sqrt(p[0] ** 2 + p[1] ** 2)
def get_hierarchy_control_points(g, t, tpos, beta=0.8): def get_hierarchy_control_points(g, t, tpos, beta=0.8):
r"""Return the Bézier spline control points for the edges in ``g``, given r"""Return the Bézier spline control points for the edges in ``g``, given the hierarchical structure encoded in graph `t`.
the hierarchical structure encoded in graph `t`.
Parameters Parameters
---------- ----------
...@@ -1030,7 +1029,7 @@ def get_hierarchy_control_points(g, t, tpos, beta=0.8): ...@@ -1030,7 +1029,7 @@ def get_hierarchy_control_points(g, t, tpos, beta=0.8):
Directed graph containing the hierarchy of ``g``. It must be a directed Directed graph containing the hierarchy of ``g``. It must be a directed
tree with a single root. The direction of the edges point from the root tree with a single root. The direction of the edges point from the root
to the leaves, and the vertices in ``t`` with index in the range to the leaves, and the vertices in ``t`` with index in the range
:math:`[0, N-1]`, with `:math:`N` being the number of vertices in ``g``, :math:`[0, N-1]`, with :math:`N` being the number of vertices in ``g``,
must correspond to the respective vertex in ``g``. must correspond to the respective vertex in ``g``.
tpos : :class:`~graph_tool.PropertyMap` tpos : :class:`~graph_tool.PropertyMap`
Vector-valued vertex property map containing the x and y coordinates of Vector-valued vertex property map containing the x and y coordinates of
......
...@@ -52,13 +52,14 @@ Examples ...@@ -52,13 +52,14 @@ Examples
In this module, most documentation examples will make use of the network In this module, most documentation examples will make use of the network
:download:`search_example.xml <search_example.xml>`, shown below. :download:`search_example.xml <search_example.xml>`, shown below.
>>> gt.seed_rng(42)
>>> g = gt.load_graph("search_example.xml") >>> g = gt.load_graph("search_example.xml")
>>> name = g.vertex_properties["name"] >>> name = g.vp["name"]
>>> weight = g.edge_properties["weight"] >>> weight = g.ep["weight"]
>>> pos = gt.graph_draw(g, vertex_text=name, vertex_font_size=12, vertex_shape="double_circle", >>> pos = g.vp["pos"]
>>> gt.graph_draw(g, pos, vertex_text=name, vertex_font_size=12, vertex_shape="double_circle",
... vertex_fill_color="#729fcf", vertex_pen_width=3, ... vertex_fill_color="#729fcf", vertex_pen_width=3,
... edge_pen_width=weight, output="search_example.pdf") ... edge_pen_width=weight, output="search_example.pdf")
<...>
.. testcode:: .. testcode::
:hide: :hide:
......
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