diff --git a/doc/draw.rst b/doc/draw.rst index cc302f5e1973f1f5fd0f9ff280c65b4d353a0a68..ae025c5da7dd42fd75ead4601f5d74ebf48ba1f7 100644 --- a/doc/draw.rst +++ b/doc/draw.rst @@ -1,4 +1,5 @@ .. automodule:: graph_tool.draw + :no-members: Layout algorithms ================= diff --git a/doc/search_example.xml b/doc/search_example.xml index 7e67162c4a378bbf346cdc025cce8f0027666a33..57b97b75051b5f7fb3d440f97e05588d9046d6a6 100644 --- a/doc/search_example.xml +++ b/doc/search_example.xml @@ -5,7 +5,8 @@ - + + @@ -14,86 +15,96 @@ Bob + -0x1.ef066a9bc7566p+8, -0x1.8cba14a4daf9ep+8 Alice + -0x1.eff87ddcb5dcdp+8, -0x1.8be648e13bf73p+8 Carol + -0x1.eec36defefc65p+8, -0x1.8bfb011626325p+8 Carlos + -0x1.ef434147d196bp+8, -0x1.8bf303e0a8156p+8 Chuck + -0x1.ee23a5c21581dp+8, -0x1.8c946519352c7p+8 Dave + -0x1.f07f37873d595p+8, -0x1.8b75d14dbc907p+8 Eve + -0x1.ee9849cf138ffp+8, -0x1.8c6143c2dad9p+8 Isaac + -0x1.ee7057c39cfedp+8, -0x1.8cf90ebb37008p+8 Oscar + -0x1.f0a22f1b03f88p+8, -0x1.8c165cbc20962p+8 Imothep + -0x1.ee3d366d42ab8p+8, -0x1.8b9e54a9a27b3p+8 - 0x1.9e7393907213cp+1 + 0x1.9e7393907213cp+1 - 0x1.015b0db294a3dp+2 + 0x1.015b0db294a3dp+2 - 0x1.12bcc343cdc2ap+2 + 0x1.12bcc343cdc2ap+2 - 0x1.ba3952afb7e9ep+1 + 0x1.ba3952afb7e9ep+1 - 0x1.0ff8065948f03p+1 + 0x1.0ff8065948f03p+1 - 0x1.a872068a0a4e5p+1 + 0x1.a872068a0a4e5p+1 - 0x1.2816bc78b034fp+2 + 0x1.2816bc78b034fp+2 - 0x1.82250c1278b54p+2 + 0x1.82250c1278b54p+2 - 0x1.8bb78dae3ee5ap+0 + 0x1.8bb78dae3ee5ap+0 - 0x1.587ad2707187fp+2 + 0x1.587ad2707187fp+2 - 0x1.7df6a3095905ep+2 + 0x1.7df6a3095905ep+2 - 0x1.62ac71123a64ap+0 + 0x1.62ac71123a64ap+0 - 0x1.2c156b7e6a49p+1 + 0x1.2c156b7e6a49p+1 - 0x1.543c16e43a9bfp+2 + 0x1.543c16e43a9bfp+2 - 0x1.5a4ab7454f0e2p+1 + 0x1.5a4ab7454f0e2p+1 - 0x1.841d9db6417f3p+1 + 0x1.841d9db6417f3p+1 - 0x1.20af02e97ed9ep+2 + 0x1.20af02e97ed9ep+2 diff --git a/src/graph_tool/community/blockmodel.py b/src/graph_tool/community/blockmodel.py index 0a23e647ac029dca3720ef6d5690f37c6759490f..40d55241ff2bf8a20885d2aaa4402302ba862f17 100644 --- a/src/graph_tool/community/blockmodel.py +++ b/src/graph_tool/community/blockmodel.py @@ -601,9 +601,9 @@ def model_entropy(B, N, E, directed=False, nr=None): References ---------- - .. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", - Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. - .. [peixoto-hierarchical-2014] Tiago P. Peixoto, "Hierarchical block structures and high-resolution + .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks", + Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. + .. [peixoto-hierarchical-2013] Tiago P. Peixoto, "Hierarchical block structures and high-resolution model selection in large networks ", :arxiv:`1310.4377`. """ @@ -647,8 +647,8 @@ def get_max_B(N, E, directed=False): References ---------- - .. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", - Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. + .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks", + 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): References ---------- - .. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", - Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. + .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks", + Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. """ if N != float("inf"): @@ -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 `N` is the number of vertices, where each vertex can be selected with 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 vertices will be attempted. verbose : ``bool`` (optional, default: ``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 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 - [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 number of edges in the network. @@ -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 Ensembles." Physical Review E 85, no. 5 (2012): 056122. :doi:`10.1103/PhysRevE.85.056122`, :arxiv:`1112.6028`. - .. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", - Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. - .. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy + .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks", + Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. + .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy 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, random_move=False, c=1., dense=False, multigraph=False, sequential=True, checkpoint=None, minimize_state=None, verbose=False): - r"""Performs an agglomerative heuristic, which progressively merges blocks - together (while allowing individual node moves) to achieve a good partition - in ``B`` blocks. + r"""Performs an agglomerative heuristic, which progressively merges blocks together (while allowing individual node moves) to achieve a good partition in ``B`` blocks. Parameters ---------- @@ -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, 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. 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, 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`. """ @@ -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` and :math:`\beta\to\infty`), and minimizing :math:`\Sigma_{t/c}` via an 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}})`, 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 .. [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`, :arxiv:`1112.6028`. - .. [peixoto-parsimonious-2014] Tiago P. Peixoto, "Parsimonious module inference in large networks", - Phys. Rev. Lett. 110, 148701 (2014), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. - .. [peixoto-efficient-2014] Tiago P. Peixoto, "Efficient Monte Carlo and greedy + .. [peixoto-parsimonious-2013] Tiago P. Peixoto, "Parsimonious module inference in large networks", + Phys. Rev. Lett. 110, 148701 (2013), :doi:`10.1103/PhysRevLett.110.148701`, :arxiv:`1212.4794`. + .. [peixoto-efficient-2013] Tiago P. Peixoto, "Efficient Monte Carlo and greedy heuristic for the inference of stochastic block models", :arxiv:`1310.4378`. """ diff --git a/src/graph_tool/community/nested_blockmodel.py b/src/graph_tool/community/nested_blockmodel.py index 72b5007870079360f104b2ebf5afa059e4382eae..6054362923b62dcaab457d300ca805b115afd619 100644 --- a/src/graph_tool/community/nested_blockmodel.py +++ b/src/graph_tool/community/nested_blockmodel.py @@ -333,9 +333,9 @@ def nested_mcmc_sweep(state, beta=1., random_move=False, c=1., sequential=True, 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`. - .. [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`. """ @@ -576,9 +576,9 @@ def nested_tree_sweep(state, nsweeps=10, epsilon=0., r=2., 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`. - .. [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`. """ @@ -811,9 +811,9 @@ def init_nested_state(g, Bs, deg_corr=True, dense=False, 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`. - .. [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`. """ @@ -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!. - 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` 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, 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`. - .. [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`. """ diff --git a/src/graph_tool/draw/cairo_draw.py b/src/graph_tool/draw/cairo_draw.py index e2a677b7cc323e702367cf19b8466c0ea045d2b3..bbf05b5acb55dcf03cc02417ad6ae566870555b8 100644 --- a/src/graph_tool/draw/cairo_draw.py +++ b/src/graph_tool/draw/cairo_draw.py @@ -1019,8 +1019,7 @@ def transform_scale(M, scale): return np.sqrt(p[0] ** 2 + p[1] ** 2) 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 - the hierarchical structure encoded in graph `t`. + r"""Return the Bézier spline control points for the edges in ``g``, given the hierarchical structure encoded in graph `t`. Parameters ---------- @@ -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 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 - :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``. tpos : :class:`~graph_tool.PropertyMap` Vector-valued vertex property map containing the x and y coordinates of diff --git a/src/graph_tool/search/__init__.py b/src/graph_tool/search/__init__.py index a98937526c9e341d0283093445ed0089ce41453b..26d4491e520e3dbb826a3d3f51d0f5ad0af67a2d 100644 --- a/src/graph_tool/search/__init__.py +++ b/src/graph_tool/search/__init__.py @@ -52,13 +52,14 @@ Examples In this module, most documentation examples will make use of the network :download:`search_example.xml `, shown below. ->>> gt.seed_rng(42) >>> g = gt.load_graph("search_example.xml") ->>> name = g.vertex_properties["name"] ->>> weight = g.edge_properties["weight"] ->>> pos = gt.graph_draw(g, vertex_text=name, vertex_font_size=12, vertex_shape="double_circle", -... vertex_fill_color="#729fcf", vertex_pen_width=3, -... edge_pen_width=weight, output="search_example.pdf") +>>> name = g.vp["name"] +>>> weight = g.ep["weight"] +>>> 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, +... edge_pen_width=weight, output="search_example.pdf") +<...> .. testcode:: :hide: