Skip to content
GitLab
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
f231d035
Commit
f231d035
authored
Sep 02, 2011
by
Tiago Peixoto
Browse files
Generate pdf images in the documentation by default
Images are now converted to png a posteriori for html output, but are used as pdf for latex.
parent
44917c1c
Changes
12
Hide whitespace changes
Inline
Side-by-side
doc/.templates/layout.html
View file @
f231d035
...
...
@@ -22,5 +22,8 @@
{% block sidebarsearch %}
{{ super() }}
<a
href=
"graph-tool.pdf"
>
(Download PDF version)
</a>
<p/>
Latest
<a
href=
"/graph-tool/doc/dev/"
>
development version docs
</a>
are also available.
{% endblock %}
doc/Makefile
View file @
f231d035
all
:
PDFIMAGES
=
$(
shell
ls
*
.pdf
)
PNGIMAGES
=
${PDFIMAGES:.pdf=.png}
HUGEIMAGES
=
$(
shell
find
.
-name
"*.pdf"
-size
+1000k
)
ORIGIMAGES
=
${
HUGEIMAGES
:.pdf
=.pdf-orig
}
PNGCONV
=
gm convert
-density
600
-resample
50
-trim
-antialias
-quality
9
-filter
Cubic
all
:
$(ORIGIMAGES) $(PNGIMAGES)
sphinx-build
-E
-b
html
.
build
%.pdf-orig
:
%.pdf
cp
$<
$@
gm mogrify
-resize
600
-trim
-antialias
-filter
Cubic
$<
%.png
:
%.pdf
test
-d
$<
-orig
&&
$(PNGCONV)
$<
-orig
$@
||
true
test
-d
$<
-orig
||
$(PNGCONV)
$<
$@
||
true
latex
:
sphinx-build
-E
-b
latex
.
build
...
...
@@ -9,3 +24,7 @@ test:
push
:
rsync
-rEvpLz
build/
*
root@skewed.de:/var/www/graph-tool-doc/
push-dev
:
rsync
-rEvpLz
build/
*
root@skewed.de:/var/www/graph-tool-doc/dev/
doc/conf.py
View file @
f231d035
...
...
@@ -215,12 +215,19 @@ latex_documents = [
ur
'Tiago de Paula Peixoto'
,
'manual'
),
]
#latex_logo = "graph-draw.png"
latex_preamble
=
"""
\setcounter{tocdepth}{2}
"""
latex_show_pagerefs
=
True
latex_show_urls
=
False
latex_paper_size
=
"a4"
latex_logo
=
"blockmodel.pdf"
latex_elements
=
{
'papersize'
:
"a4paper"
,
'fontpkg'
:
r
"\usepackage{palatino}\usepackage{eulervm}"
}
'fontpkg'
:
r
"\usepackage{bookman}"
}
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping
=
{
'python'
:
(
'http://docs.python.org'
,
None
),
...
...
doc/price.py
View file @
f231d035
...
...
@@ -66,7 +66,7 @@ gca().set_xlim(0.8, 1e3)
subplots_adjust
(
left
=
0.2
,
bottom
=
0.2
)
xlabel
(
"$k_{in}$"
)
ylabel
(
"$NP(k_{in})$"
)
savefig
(
"deg-hist.p
ng
"
)
savefig
(
"deg-hist.p
df
"
)
# let's do a random walk on the graph and print the age of the vertices we find,
# just for fun.
...
...
doc/quickstart.rst
View file @
f231d035
...
...
@@ -83,10 +83,10 @@ visualize the graph we created so far with the
.. doctest::
>>> graph_draw(g, vprops={"label": g.vertex_index}, output="two-nodes.p
ng
")
>>> graph_draw(g, vprops={"label": g.vertex_index}, output="two-nodes.p
df
")
<...>
.. figure:: two-nodes.
png
.. figure:: two-nodes.
*
:align: center
A simple directed graph with two vertices and one edge, created by
...
...
@@ -451,7 +451,7 @@ This is the degree distribution, with 100000 nodes. If you want to see a broader
power law, try to increase the number of vertices to something like :math:`10^6`
or :math:`10^7`.
.. figure:: deg-hist.
png
.. figure:: deg-hist.
*
:align: center
In-degree distribution of a price network with 100000 nodes.
...
...
@@ -463,9 +463,9 @@ use the :func:`~graph_tool.draw.graph_draw` function.
g = load_graph("price.xml.gz")
age = g.vertex_properties["age"]
graph_draw(g, size=(15,15), vcolor=age, output="price.p
ng
")
graph_draw(g, size=(15,15), vcolor=age, output="price.p
df
")
.. figure:: price.
png
.. figure:: price.
*
:align: center
A Price network with :math:`10^5` nodes. The vertex colors represent
...
...
@@ -508,13 +508,13 @@ edge filtering.
g, pos = triangulation(random((500, 2)) * 4, type="delaunay")
tree = min_spanning_tree(g)
graph_draw(g, pos=pos, pin=True, size=(8, 8), ecolor=tree, output="min_tree.p
ng
")
graph_draw(g, pos=pos, pin=True, size=(8, 8), ecolor=tree, output="min_tree.p
df
")
The ``tree`` property map has a bool type, with value "1" if the edge belongs to
the tree, and "0" otherwise. Below is an image of the original graph, with the
marked edges.
.. figure:: min_tree.
png
.. figure:: min_tree.
*
:align: center
We can now filter out the edges which don't belong to the minimum spanning tree.
...
...
@@ -522,11 +522,11 @@ We can now filter out the edges which don't belong to the minimum spanning tree.
.. testcode::
g.set_edge_filter(tree)
graph_draw(g, pos=pos, pin=True, size=(8, 8), output="min_tree_filtered.p
ng
")
graph_draw(g, pos=pos, pin=True, size=(8, 8), output="min_tree_filtered.p
df
")
This is how the graph looks when filtered:
.. figure:: min_tree_filtered.
png
.. figure:: min_tree_filtered.
*
:align: center
Everything should work transparently on the filtered graph, simply as if the
...
...
@@ -539,9 +539,9 @@ and draws them as colors and line thickness in the graph.
bv, be = betweenness(g)
be.a *= 10
graph_draw(g, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=bv,
eprops={"penwidth":be}, output="filtered-bt.p
ng
")
eprops={"penwidth":be}, output="filtered-bt.p
df
")
.. figure:: filtered-bt.
png
.. figure:: filtered-bt.
*
:align: center
...
...
@@ -553,9 +553,9 @@ The original graph can be recovered by setting the edge filter to ``None``.
bv, be = betweenness(g)
be.a *= 10
graph_draw(g, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=bv,
eprops={"penwidth":be}, output="nonfiltered-bt.p
ng
")
eprops={"penwidth":be}, output="nonfiltered-bt.p
df
")
.. figure:: nonfiltered-bt.
png
.. figure:: nonfiltered-bt.
*
:align: center
Everything works in analogous fashion with vertex filtering.
...
...
@@ -609,11 +609,11 @@ Like above, the result should be the isolated minimum spanning tree:
>>> bv, be = betweenness(tv)
>>> be.a *= 10
>>> graph_draw(tv, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=bv,
... eprops={"penwidth":be}, output="mst-view.p
ng
")
... eprops={"penwidth":be}, output="mst-view.p
df
")
<...>
.. figure:: mst-view.
png
.. figure:: mst-view.
*
:align: center
A view of the Delaunay graph, isolating only the minimum spanning tree.
...
...
@@ -654,10 +654,10 @@ The graph view constructed above can be visualized as
.. doctest::
>>> graph_draw(u, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=bv,
... output="central-edges-view.p
ng
")
... output="central-edges-view.p
df
")
<...>
.. figure:: central-edges-view.
png
.. figure:: central-edges-view.
*
:align: center
A view of the Delaunay graph, isolating only the edges with
...
...
@@ -682,10 +682,10 @@ The resulting graph view can be visualized as
.. doctest::
>>> graph_draw(u, pos=pos, pin=True, size=(8,8), vsize=0.07,
... output="composed-filter.p
ng
")
... output="composed-filter.p
df
")
<...>
.. figure:: composed-filter.
png
.. figure:: composed-filter.
*
:align: center
A composed view, obtained as the minimum spanning tree of all vertices
...
...
src/graph_tool/community/__init__.py
View file @
f231d035
...
...
@@ -149,13 +149,13 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
>>> spins = gt.community_structure(g, 10000, 20, t_range=(5, 0.1),
... history_file="community-history1")
>>> gt.graph_draw(g, pos=pos, pin=True, vsize=0.3, vcolor=spins,
... output="comm1.p
ng
", size=(10,10))
... output="comm1.p
df
", size=(10,10))
<...>
>>> spins = gt.community_structure(g, 10000, 40, t_range=(5, 0.1),
... gamma=2.5,
... history_file="community-history2")
>>> gt.graph_draw(g, pos=pos, pin=True, vsize=0.3, vcolor=spins,
... output="comm2.p
ng
", size=(10,10))
... output="comm2.p
df
", size=(10,10))
<...>
>>> clf()
>>> xlabel("iterations")
...
...
@@ -165,7 +165,7 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
>>> a = loadtxt("community-history1").transpose()
>>> plot(a[0], a[2])
[...]
>>> savefig("comm1-hist.p
ng
")
>>> savefig("comm1-hist.p
df
")
>>> clf()
>>> xlabel("iterations")
<...>
...
...
@@ -174,18 +174,18 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
>>> a = loadtxt("community-history2").transpose()
>>> plot(a[0], a[2])
[...]
>>> savefig("comm2-hist.p
ng
")
>>> savefig("comm2-hist.p
df
")
The community structure with :math:`\gamma=1`:
.. image:: comm1.
png
.. image:: comm1-hist.
png
.. image:: comm1.
*
.. image:: comm1-hist.
*
The community structure with :math:`\gamma=2.5`:
.. image:: comm2.
png
.. image:: comm2-hist.
png
.. image:: comm2.
*
.. image:: comm2-hist.
*
References
...
...
@@ -328,10 +328,10 @@ def condensation_graph(g, prop, weight=None):
>>> size.a = log(ng[1].a+1)
>>> gt.graph_draw(ng[0], vsize=size, vcolor=size, splines=True,
... eprops={"len":20, "penwidth":10}, vprops={"penwidth":10},
... output="comm-network.p
ng
", size=(10,10))
... output="comm-network.p
df
", size=(10,10))
<...>
.. figure:: comm-network.
png
.. figure:: comm-network.
*
:align: center
Community network of a random graph. The color and sizes of the nodes
...
...
src/graph_tool/correlations/__init__.py
View file @
f231d035
...
...
@@ -277,9 +277,9 @@ def corr_hist(g, deg_source, deg_target, bins=[[0, 1], [0, 1]], weight=None,
<...>
>>> colorbar()
<...>
>>> savefig("corr.p
ng
")
>>> savefig("corr.p
df
")
.. figure:: corr.
png
.. figure:: corr.
*
:align: center
Out/out-degree correlation histogram.
...
...
@@ -363,9 +363,9 @@ def combined_corr_hist(g, deg1, deg2, bins=[[0, 1], [0, 1]], float_count=True):
<...>
>>> colorbar()
<...>
>>> savefig("combined_corr.p
ng
")
>>> savefig("combined_corr.p
df
")
.. figure:: combined_corr.
png
.. figure:: combined_corr.
*
:align: center
Combined in/out-degree correlation histogram.
...
...
@@ -453,9 +453,9 @@ def avg_neighbour_corr(g, deg_source, deg_target, bins=[0, 1], weight=None):
<...>
>>> errorbar(h[2][:-1], h[0], yerr=h[1], fmt="o")
(...)
>>> savefig("avg_corr.p
ng
")
>>> savefig("avg_corr.p
df
")
.. figure:: avg_corr.
png
.. figure:: avg_corr.
*
:align: center
Average out/out degree correlation.
...
...
@@ -530,9 +530,9 @@ def avg_combined_corr(g, deg1, deg2, bins=[0, 1]):
<...>
>>> errorbar(h[2][:-1], h[0], yerr=h[1], fmt="o")
(...)
>>> savefig("combined_avg_corr.p
ng
")
>>> savefig("combined_avg_corr.p
df
")
.. figure:: combined_avg_corr.
png
.. figure:: combined_avg_corr.
*
:align: center
Average combined in/out-degree correlation.
...
...
src/graph_tool/draw/__init__.py
View file @
f231d035
...
...
@@ -283,10 +283,10 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout=None, maxiter=None,
>>> ebet.a += 10
>>> gt.graph_draw(g, vsize=deg, vcolor=deg, vorder=deg, elen=10,
... ecolor=ebet, eorder=ebet, penwidth=ebet,
... overlap="prism", output="graph-draw.p
ng
")
... overlap="prism", output="graph-draw.p
df
")
<...>
.. figure:: graph-draw.
png
.. figure:: graph-draw.
*
:align: center
Kamada-Kawai force-directed layout of a graph with a power-law degree
...
...
@@ -686,10 +686,10 @@ def fruchterman_reingold_layout(g, weight=None, a=None, r=1., scale=None,
>>> seed(42)
>>> g = gt.price_network(300)
>>> pos = gt.fruchterman_reingold_layout(g, n_iter=1000)
>>> gt.graph_draw(g, pos=pos, pin=True, output="graph-draw-fr.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, output="graph-draw-fr.p
df
")
<...>
.. figure:: graph-draw-fr.
png
.. figure:: graph-draw-fr.
*
:align: center
Fruchterman-Reingold layout of a Price network.
...
...
@@ -767,10 +767,10 @@ def arf_layout(g, weight=None, d=0.5, a=10, dt=0.001, epsilon=1e-6,
>>> seed(42)
>>> g = gt.price_network(300)
>>> pos = gt.arf_layout(g, max_iter=0)
>>> gt.graph_draw(g, pos=pos, pin=True, output="graph-draw-arf.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, output="graph-draw-arf.p
df
")
<...>
.. figure:: graph-draw-arf.
png
.. figure:: graph-draw-arf.
*
:align: center
ARF layout of a Price network.
...
...
src/graph_tool/flow/__init__.py
View file @
f231d035
...
...
@@ -59,10 +59,10 @@ The following network will be used as an example throughout the documentation.
g.edge_properties["cap"] = cap
g.vertex_properties["pos"] = pos
g.save("flow-example.xml.gz")
gt.graph_draw(g, pos=pos, pin=True, penwidth=cap, output="flow-example.p
ng
")
gt.graph_draw(g, pos=pos, pin=True, penwidth=cap, output="flow-example.p
df
")
.. figure:: flow-example.
png
.. figure:: flow-example.
*
:align: center
Example network used in the documentation below. The edge capacities are
...
...
@@ -129,10 +129,10 @@ def edmonds_karp_max_flow(g, source, target, capacity, residual=None):
>>> print max_flow
6.92759897841
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-edmonds-karp.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-edmonds-karp.p
df
")
<...>
.. figure:: example-edmonds-karp.
png
.. figure:: example-edmonds-karp.
*
:align: center
Edge flows obtained with the Edmonds-Karp algorithm. The source and
...
...
@@ -205,10 +205,10 @@ def push_relabel_max_flow(g, source, target, capacity, residual=None):
>>> print max_flow
6.92759897841
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-push-relabel.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-push-relabel.p
df
")
<...>
.. figure:: example-push-relabel.
png
.. figure:: example-push-relabel.
*
:align: center
...
...
@@ -282,10 +282,10 @@ def boykov_kolmogorov_max_flow(g, source, target, capacity, residual=None):
>>> print max_flow
6.92759897841
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-kolmogorov.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, penwidth=res, output="example-kolmogorov.p
df
")
<...>
.. figure:: example-kolmogorov.
png
.. figure:: example-kolmogorov.
*
:align: center
Edge flows obtained with the Boykov-Kolmogorov algorithm. The source and
...
...
@@ -353,10 +353,10 @@ def max_cardinality_matching(g, match=None):
>>> res = gt.max_cardinality_matching(g)
>>> print res[1]
True
>>> gt.graph_draw(g, ecolor=res[0], output="max_card_match.p
ng
")
>>> gt.graph_draw(g, ecolor=res[0], output="max_card_match.p
df
")
<...>
.. figure:: max_card_match.
png
.. figure:: max_card_match.
*
:align: center
Edges belonging to the matching are in red.
...
...
src/graph_tool/generation/__init__.py
View file @
f231d035
...
...
@@ -134,7 +134,7 @@ def random_graph(N, deg_sampler, deg_corr=None, directed=True,
``mix_time`` parameter passed as ``n_iter``.
The complexity is :math:`O(V + E)` if parallel edges are allowed, and
:math:`O(V + E \times\text{mix
_
time})` if parallel edges are not allowed.
:math:`O(V + E \times\text{mix
-
time})` if parallel edges are not allowed.
.. note ::
...
...
@@ -213,9 +213,9 @@ def random_graph(N, deg_sampler, deg_corr=None, directed=True,
<...>
>>> ylabel("out-degree")
<...>
>>> savefig("combined-deg-hist.p
ng
")
>>> savefig("combined-deg-hist.p
df
")
.. figure:: combined-deg-hist.
png
.. figure:: combined-deg-hist.
*
:align: center
Combined degree histogram.
...
...
@@ -266,9 +266,9 @@ def random_graph(N, deg_sampler, deg_corr=None, directed=True,
<...>
>>> ylabel("average target degree")
<...>
>>> savefig("deg-corr-dir.p
ng
")
>>> savefig("deg-corr-dir.p
df
")
.. figure:: deg-corr-dir.
png
.. figure:: deg-corr-dir.
*
:align: center
Average nearest neighbour correlations.
...
...
@@ -292,10 +292,10 @@ def random_graph(N, deg_sampler, deg_corr=None, directed=True,
>>> g, bm = gt.random_graph(1000, lambda: poisson(10), directed=False,
... blockmodel=lambda: randint(10), deg_corr=corr,
... mix_time=500)
>>> gt.graph_draw(g, vcolor=bm, layout="sfdp", output="blockmodel.p
ng
")
>>> gt.graph_draw(g, vcolor=bm, layout="sfdp", output="blockmodel.p
df
")
<...>
.. figure:: blockmodel.
png
.. figure:: blockmodel.
*
:align: center
Simple blockmodel with 10 blocks.
...
...
@@ -477,8 +477,8 @@ def random_rewire(g, strat="uncorrelated", n_iter=1, edge_sweep=True,
Each edge is tentatively swapped once per iteration, so the overall
complexity is :math:`O(V + E \times \text{n
_
iter})`. If ``edge_sweep ==
False``, the complexity becomes :math:`O(V + E + \text{n
_
iter})`.
complexity is :math:`O(V + E \times \text{n
-
iter})`. If ``edge_sweep ==
False``, the complexity becomes :math:`O(V + E + \text{n
-
iter})`.
Examples
--------
...
...
@@ -489,24 +489,24 @@ def random_rewire(g, strat="uncorrelated", n_iter=1, edge_sweep=True,
>>> from pylab import *
>>> seed(43)
>>> g, pos = gt.triangulation(random((1000,2)))
>>> gt.graph_draw(g, layout="arf", output="rewire_orig.p
ng
", size=(6,6))
>>> gt.graph_draw(g, layout="arf", output="rewire_orig.p
df
", size=(6,6))
<...>
>>> gt.random_rewire(g, "correlated")
>>> gt.graph_draw(g, layout="arf", output="rewire_corr.p
ng
", size=(6,6))
>>> gt.graph_draw(g, layout="arf", output="rewire_corr.p
df
", size=(6,6))
<...>
>>> gt.random_rewire(g)
>>> gt.graph_draw(g, layout="arf", output="rewire_uncorr.p
ng
", size=(6,6))
>>> gt.graph_draw(g, layout="arf", output="rewire_uncorr.p
df
", size=(6,6))
<...>
>>> gt.random_rewire(g, "erdos")
>>> gt.graph_draw(g, layout="arf", output="rewire_erdos.p
ng
", size=(6,6))
>>> gt.graph_draw(g, layout="arf", output="rewire_erdos.p
df
", size=(6,6))
<...>
Some `ridiculograms <http://www.youtube.com/watch?v=YS-asmU3p_4>`_ :
.. image:: rewire_orig.
png
.. image:: rewire_corr.
png
.. image:: rewire_uncorr.
png
.. image:: rewire_erdos.
png
.. image:: rewire_orig.
*
.. image:: rewire_corr.
*
.. image:: rewire_uncorr.
*
.. image:: rewire_erdos.
*
*From left to right:* Original graph --- Shuffled graph, with degree
correlations --- Shuffled graph, without degree correlations --- Shuffled graph,
...
...
@@ -540,9 +540,9 @@ def random_rewire(g, strat="uncorrelated", n_iter=1, edge_sweep=True,
<...>
>>> legend(loc="best")
<...>
>>> savefig("shuffled-stats.p
ng
")
>>> savefig("shuffled-stats.p
df
")
.. figure:: shuffled-stats.
png
.. figure:: shuffled-stats.
*
:align: center
Average degree correlations for the different shuffled and non-shuffled
...
...
@@ -592,9 +592,9 @@ def random_rewire(g, strat="uncorrelated", n_iter=1, edge_sweep=True,
<...>
>>> ylabel("average target degree")
<...>
>>> savefig("shuffled-deg-corr-dir.p
ng
")
>>> savefig("shuffled-deg-corr-dir.p
df
")
.. figure:: shuffled-deg-corr-dir.
png
.. figure:: shuffled-deg-corr-dir.
*
:align: center
Average degree correlations for the different shuffled and non-shuffled
...
...
@@ -722,16 +722,16 @@ def graph_union(g1, g2, props=None, include=False):
>>> g = gt.triangulation(random((300,2)))[0]
>>> ug = gt.graph_union(g, g)
>>> uug = gt.graph_union(g, ug)
>>> gt.graph_draw(g, layout="arf", size=(8,8), output="graph_original.p
ng
")
>>> gt.graph_draw(g, layout="arf", size=(8,8), output="graph_original.p
df
")
<...>
>>> gt.graph_draw(ug, layout="arf", size=(8,8), output="graph_union.p
ng
")
>>> gt.graph_draw(ug, layout="arf", size=(8,8), output="graph_union.p
df
")
<...>
>>> gt.graph_draw(uug, layout="arf", size=(8,8), output="graph_union2.p
ng
")
>>> gt.graph_draw(uug, layout="arf", size=(8,8), output="graph_union2.p
df
")
<...>
.. image:: graph_original.
png
.. image:: graph_union.
png
.. image:: graph_union2.
png
.. image:: graph_original.
*
.. image:: graph_union.
*
.. image:: graph_union2.
*
"""
if
props
==
None
:
...
...
@@ -837,7 +837,7 @@ def triangulation(points, type="simple", periodic=False):
>>> b = gt.betweenness(g, weight=weight)
>>> b[1].a *= 100
>>> gt.graph_draw(g, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=b[0],
... eprops={"penwidth":b[1]}, output="triang.p
ng
")
... eprops={"penwidth":b[1]}, output="triang.p
df
")
<...>
>>> g, pos = gt.triangulation(points, type="delaunay")
>>> weight = g.new_edge_property("double")
...
...
@@ -847,13 +847,13 @@ def triangulation(points, type="simple", periodic=False):
>>> b = gt.betweenness(g, weight=weight)
>>> b[1].a *= 120
>>> gt.graph_draw(g, pos=pos, pin=True, size=(8,8), vsize=0.07, vcolor=b[0],
... eprops={"penwidth":b[1]}, output="triang-delaunay.p
ng
")
... eprops={"penwidth":b[1]}, output="triang-delaunay.p
df
")
<...>
2D triangulation of random points:
.. image:: triang.
png
.. image:: triang-delaunay.
png
.. image:: triang.
*
.. image:: triang-delaunay.
*
*Left:* Simple triangulation. *Right:* Delaunay triangulation. The vertex
colors and the edge thickness correspond to the weighted betweenness
...
...
@@ -904,18 +904,18 @@ def lattice(shape, periodic=False):
Examples
--------
>>> g = gt.lattice([10,10])
>>> gt.graph_draw(g, size=(8,8), output="lattice.p
ng
")
>>> gt.graph_draw(g, size=(8,8), output="lattice.p
df
")
<...>
>>> g = gt.lattice([10,20], periodic=True)
>>> gt.graph_draw(g, size=(8,8), output="lattice_periodic.p
ng
")
>>> gt.graph_draw(g, size=(8,8), output="lattice_periodic.p
df
")
<...>
>>> g = gt.lattice([10,10,10])
>>> gt.graph_draw(g, size=(8,8), output="lattice_3d.p
ng
")
>>> gt.graph_draw(g, size=(8,8), output="lattice_3d.p
df
")
<...>
.. image:: lattice.
png
.. image:: lattice_periodic.
png
.. image:: lattice_3d.
png
.. image:: lattice.
*
.. image:: lattice_periodic.
*
.. image:: lattice_3d.
*
*Left:* 10x10 2D lattice. *Middle:* 10x20 2D periodic lattice (torus).
*Right:* 10x10x10 3D lattice.
...
...
@@ -974,14 +974,14 @@ def geometric_graph(points, radius, ranges=None):
>>> seed(42)
>>> points = random((500, 2)) * 4
>>> g, pos = gt.geometric_graph(points, 0.3)
>>> gt.graph_draw(g, pos=pos, pin=True, size=(8,8), output="geometric.p
ng
")
>>> gt.graph_draw(g, pos=pos, pin=True, size=(8,8), output="geometric.p
df
")
<...>
>>> g, pos = gt.geometric_graph(points, 0.3, [(0,4), (0,4)])
>>> gt.graph_draw(g, size=(8,8), output="geometric_periodic.p
ng
")
>>> gt.graph_draw(g, size=(8,8), output="geometric_periodic.p
df
")
<...>
.. image:: geometric.
png
.. image:: geometric_periodic.
png
.. image:: geometric.
*
.. image:: geometric_periodic.
*
*Left:* Geometric network with random points. *Right:* Same network, but
with periodic boundary conditions.
...
...
@@ -1092,15 +1092,15 @@ def price_network(N, m=1, c=None, gamma=1, directed=True, seed_graph=None):
>>> seed(42)
>>> g = gt.price_network(100000)
>>> gt.graph_draw(g, layout="sfdp", size=(12,12), vcolor=g.vertex_index,
... output="price-network.p
ng
")
... output="price-network.p
df
")
<...>
>>> g = gt.price_network(100000, c=0.1)
>>> gt.graph_draw(g, layout="sfdp", size=(12,12), vcolor=g.vertex_index,
... output="price-network-broader.p
ng
")
... output="price-network-broader.p
df
")
<...>
.. image:: price-network.
png
.. image:: price-network-broader.
png
.. image:: price-network.
*
.. image:: price-network-broader.
*
Price networks with :math:`N=10^5` nodes. **Left:** :math:`c=1`, **Right:**
:math:`c=0.1`. The colors represent the order in which vertices were
...
...
src/graph_tool/search/__init__.py
View file @
f231d035
...
...
@@ -60,10 +60,10 @@ In this module, most documentation examples will make use of the network
>>> gt.graph_draw(g, vprops={"label": name, "shape": "doublecircle",
... "fillcolor": "#729fcf"},
... penwidth=weight, overlap=False, splines=True,
... output="search_example.p
ng
")
... output="search_example.p
df
")
<...>
.. figure:: search_example.
png
.. figure:: search_example.
*
:alt: search example
:align: center
...
...
@@ -1358,10 +1358,10 @@ def astar_search(g, source, weight, visitor=AStarVisitor(),