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
d08bd85a
Commit
d08bd85a
authored
Sep 01, 2013
by
Tiago Peixoto
Browse files
Assorted documentation fixes
parent
1d0b48de
Changes
11
Hide whitespace changes
Inline
Side-by-side
doc/Makefile
View file @
d08bd85a
...
...
@@ -7,17 +7,18 @@ ORIGIMAGES = ${HUGEIMAGES:.pdf=.pdf-orig}
PNGCONV
=
pdftoppm
-png
-singlefile
-r
96
-freetype
yes
-aa
yes
-aaVector
yes
PDFCONV
=
gm convert
all
:
#
$(ORIGIMAGES) $(PNGIMAGES)
#all: $(ORIGIMAGES) $(PNGIMAGES)
all
:
sphinx-build
-E
-b
html
.
build
%.pdf-orig
:
%.pdf
$(PNGCONV)
$<
>
$@
-tmp
.png
$(PDFCONV)
$@
-tmp
.png
$@
rm
$@
-tmp
.png
#
%.pdf-orig: %.pdf
#
$(PNGCONV) $< > $@-tmp.png
#
$(PDFCONV) $@-tmp.png $@
#
rm $@-tmp.png
%.png
:
%.pdf
test
-d
$<
-orig
&&
$(PNGCONV)
$<
-orig
>
$@
||
true
test
-d
$<
-orig
||
$(PNGCONV)
$<
>
$@
||
true
#
%.png: %.pdf
#
test -d $<-orig && $(PNGCONV) $<-orig > $@ || true
#
test -d $<-orig || $(PNGCONV) $< > $@ || true
latex
:
sphinx-build
-E
-b
latex
.
build
...
...
@@ -25,11 +26,11 @@ latex:
test
:
OMP_NUM_THREADS
=
1 sphinx-build
-b
doctest
.
build
push
:
rsync
-rEvpLz
build/
*
root@skewed.de:/var/www/graph-tool-doc/
#
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/
#
push-dev:
#
rsync -rEvpLz build/* root@skewed.de:/var/www/graph-tool-doc/dev/
clean
:
rm
-rf
build
...
...
doc/conf.py
View file @
d08bd85a
...
...
@@ -159,7 +159,7 @@ html_copy_source = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
html_use_opensearch
=
'http://
projects.skewed.de/
graph-tool/doc/'
html_use_opensearch
=
'http://graph-tool
.skewed.de
/doc/'
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
...
...
@@ -199,7 +199,7 @@ intersphinx_mapping = {'python': ('http://docs.python.org', None),
'matplotlib'
:
(
'http://matplotlib.sourceforge.net'
,
None
),
'cairo'
:
(
'http://www.cairographics.org/documentation/pycairo/3/'
,
None
)}
extlinks
=
{
'ticket'
:
(
'http://
projects
.skewed.de/
graph-tool
/ticket/%s'
,
extlinks
=
{
'ticket'
:
(
'http://
graph-tool
.skewed.de/
tickets
/ticket/%s'
,
'ticket '
),
'doi'
:
(
'http://dx.doi.org/%s'
,
'DOI: '
),
'arxiv'
:
(
'http://arxiv.org/abs/%s'
,
'arXiv: '
)}
...
...
doc/graph_tool.rst
View file @
d08bd85a
...
...
@@ -43,6 +43,9 @@
.. automethod:: add_edge
.. automethod:: remove_edge
.. automethod:: set_fast_edge_removal
.. automethod:: get_fast_edge_removal
The following functions allow for easy removal of vertices of
edges from the graph.
...
...
doc/price.py
View file @
d08bd85a
...
...
@@ -99,3 +99,4 @@ xlabel("$k_{in}$")
ylabel
(
"$NP(k_{in})$"
)
tight_layout
()
savefig
(
"price-deg-dist.pdf"
)
savefig
(
"price-deg-dist.png"
)
doc/quickstart.rst
View file @
d08bd85a
...
...
@@ -89,14 +89,14 @@ visualize the graph we created so far with the
.. doctest::
>>> graph_draw(g, vertex_text=g.vertex_index, vertex_font_size=18,
... output_size=(200, 200), output="two-nodes.p
df
")
... output_size=(200, 200), output="two-nodes.p
ng
")
<...>
.. doctest::
:hide:
graph_draw(g, vertex_text=g.vertex_index, vertex_font_size=18,
output_size=(200, 200), output="two-nodes.p
ng
")
output_size=(200, 200), output="two-nodes.p
df
")
.. figure:: two-nodes.*
...
...
@@ -157,12 +157,22 @@ Edges and vertices can also be removed at any time with the
internally stored in a `STL vector <http://en.wikipedia.org/wiki/Vector_%28STL%29>`_,
so removing an element somewhere in the middle of the list requires
the shifting of the rest of the list. Thus, fast :math:`O(1)`
removals are only possible if one can guarantee that only vertices in
the end of the list are removed (the ones last added to the graph).
removals are only possible either if one can guarantee that only
vertices in the end of the list are removed (the ones last added to
the graph), or if the relative vertex ordering is invalidated. This
last behavior can be achieved by passing the option ``fast == True``,
to :meth:`~graph_tool.Graph.remove_vertex`, which causes vertex
being deleted to be 'swapped' with the last vertex (i.e. with the
largest index), which will in turn inherit the index of the vertex
being deleted.
Removing an edge is an :math:`O(k_{s} + k_{t})` operation, where
:math:`k_{s}` is the out-degree of the source vertex, and
:math:`k_{t}` is the in-degree of the target vertex.
:math:`k_{t}` is the in-degree of the target vertex. This can be made
faster by setting :meth:`~graph_tool.Graph.set_fast_edge_removal` to
`True`, in which case it becomes :math:`O(1)`, at the expense of
additional data of size :math:`O(E)`.
Each vertex in a graph has an unique index, which is numbered from 0 to
N-1, where N is the number of vertices. This index can be obtained by
...
...
src/graph_tool/__init__.py
View file @
d08bd85a
...
...
@@ -1344,13 +1344,13 @@ class Graph(object):
This operation is normally :math:`O(k_s + k_t)`, where :math:`k_s`
and :math:`k_s` are the total degrees of the source and target
vertices, respectively. However, if :meth
od
:`~Graph.set_fast_edge_removal`
vertices, respectively. However, if :meth:`~Graph.set_fast_edge_removal`
is set to `True`, this operation becomes :math:`O(1)`.
.. warning::
The relative ordering of the remaining edges in the graph is kept
unchanged, unless :meth
od
:`~Graph.set_fast_edge_removal` is set to
unchanged, unless :meth:`~Graph.set_fast_edge_removal` is set to
`True`, in which case it can change.
"""
self
.
__check_perms
(
"del_edge"
)
...
...
src/graph_tool/community/__init__.py
View file @
d08bd85a
...
...
@@ -189,10 +189,22 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
... history_file="community-history1")
>>> gt.graph_draw(g, pos=pos, vertex_fill_color=spins, output_size=(420, 420), output="comm1.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, pos=pos, vertex_fill_color=spins, output_size=(420, 420), output="comm1.png")
>>> 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, vertex_fill_color=spins, output_size=(420, 420), output="comm2.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, pos=pos, vertex_fill_color=spins, output_size=(420, 420), output="comm2.png")
>>> figure(figsize=(6, 4))
<...>
>>> xlabel("iterations")
...
...
@@ -203,6 +215,12 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
>>> plot(a[0], a[2])
[...]
>>> savefig("comm1-hist.pdf")
.. testcode::
:hide:
savefig("comm1-hist.png")
>>> clf()
>>> xlabel("iterations")
<...>
...
...
@@ -213,6 +231,11 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
[...]
>>> savefig("comm2-hist.pdf")
.. testcode::
:hide:
savefig("comm2-hist.png")
The community structure with :math:`\gamma=1`:
...
...
src/graph_tool/correlations/__init__.py
View file @
d08bd85a
...
...
@@ -393,7 +393,7 @@ def combined_corr_hist(g, deg1, deg2, bins=[[0, 1], [0, 1]], float_count=True):
.. testcode::
:hide:
savefig("combined_corr.p
df
")
savefig("combined_corr.p
ng
")
.. figure:: combined_corr.*
:align: center
...
...
src/graph_tool/generation/__init__.py
View file @
d08bd85a
...
...
@@ -310,7 +310,7 @@ def random_graph(N, deg_sampler, directed=True,
The blockmodel can be generated as follows.
>>> g, bm = gt.random_graph(
5
000, lambda: poisson(10), directed=False,
>>> g, bm = gt.random_graph(
2
000, lambda: poisson(10), directed=False,
... model="blockmodel-traditional",
... block_membership=lambda: randint(10),
... vertex_corr=corr)
...
...
@@ -1445,12 +1445,12 @@ def price_network(N, m=1, c=None, gamma=1, directed=True, seed_graph=None):
gt.seed_rng(42)
>>> g = gt.price_network(
10
0000)
>>> g = gt.price_network(
2
0000)
>>> gt.graph_draw(g, pos=gt.sfdp_layout(g, epsilon=1e-2, cooling_step=0.95),
... vertex_fill_color=g.vertex_index, vertex_size=2,
... edge_pen_width=1, output="price-network.png")
<...>
>>> g = gt.price_network(
10
0000, c=0.1)
>>> g = gt.price_network(
2
0000, c=0.1)
>>> gt.graph_draw(g, pos=gt.sfdp_layout(g, epsilon=1e-2, cooling_step=0.95),
... vertex_fill_color=g.vertex_index, vertex_size=2,
... edge_pen_width=1, output="price-network-broader.png")
...
...
@@ -1459,13 +1459,13 @@ def price_network(N, m=1, c=None, gamma=1, directed=True, seed_graph=None):
.. figure:: price-network.png
:align: center
Price network with :math:`N=10^
5
` nodes and :math:`c=1`. The colors
Price network with :math:`N=
2\times
10^
4
` nodes and :math:`c=1`. The colors
represent the order in which vertices were added.
.. figure:: price-network-broader.png
:align: center
Price network with :math:`N=10^
5
` nodes and :math:`c=0.1`. The colors
Price network with :math:`N=
2\times
10^
4
` nodes and :math:`c=0.1`. The colors
represent the order in which vertices were added.
...
...
src/graph_tool/search/__init__.py
View file @
d08bd85a
...
...
@@ -1396,6 +1396,13 @@ def astar_search(g, source, weight, visitor=AStarVisitor(),
... edge_pen_width=ewidth, output="astar-delaunay.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, pos=pos, output_size=(300, 300), vertex_fill_color=touch_v,
vcmap=matplotlib.cm.binary, edge_color=ecolor,
edge_pen_width=ewidth, output="astar-delaunay.png")
.. figure:: astar-delaunay.*
:align: center
...
...
src/graph_tool/topology/__init__.py
View file @
d08bd85a
...
...
@@ -261,6 +261,14 @@ def subgraph_isomorphism(sub, g, max_n=0, vertex_label=None, edge_label=None,
>>> gt.graph_draw(sub, output_size=(200, 200), output="subgraph-iso.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, vertex_fill_color=vmask, edge_color=emask,
edge_pen_width=ewidth, output_size=(200, 200),
output="subgraph-iso-embed.png")
gt.graph_draw(sub, output_size=(200, 200), output="subgraph-iso.png")
.. image:: subgraph-iso.*
.. image:: subgraph-iso-embed.*
...
...
@@ -383,6 +391,11 @@ def min_spanning_tree(g, weights=None, root=None, tree_map=None):
>>> gt.graph_draw(g, pos=pos, output="triang_min_span_tree.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, pos=pos, output="triang_orig.png")
gt.graph_draw(g, pos=pos, output="triang_min_span_tree.png")
.. image:: triang_orig.*
:width: 400px
...
...
@@ -469,6 +482,11 @@ def random_spanning_tree(g, weights=None, root=None, tree_map=None):
>>> gt.graph_draw(g, pos=pos, output="triang_random_span_tree.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, pos=pos, output="rtriang_orig.png")
gt.graph_draw(g, pos=pos, output="triang_random_span_tree.png")
.. image:: rtriang_orig.*
:width: 400px
...
...
@@ -1408,6 +1426,11 @@ def is_bipartite(g, partition=False):
>>> gt.graph_draw(g, vertex_fill_color=part, output_size=(300, 300), output="bipartite.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, vertex_fill_color=part, output_size=(300, 300), output="bipartite.png")
.. figure:: bipartite.*
:align: center
...
...
@@ -1491,6 +1514,11 @@ def is_planar(g, embedding=False, kuratowski=False):
>>> gt.graph_draw(g, output_size=(300, 300), output="kuratowski.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, output_size=(300, 300), output="kuratowski.png")
.. figure:: kuratowski.*
:align: center
...
...
@@ -1564,6 +1592,11 @@ def make_maximal_planar(g, unfilter=False):
>>> gt.graph_draw(g, output_size=(300, 300), output="maximal_planar.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, output_size=(300, 300), output="maximal_planar.png")
.. figure:: maximal_planar.*
:align: center
...
...
@@ -1677,6 +1710,12 @@ def max_cardinality_matching(g, heuristic=False, weight=None, minimize=True,
... output="max_card_match.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, edge_color=res[0], edge_pen_width=w, vertex_fill_color="grey",
output="max_card_match.png")
.. figure:: max_card_match.*
:align: center
...
...
@@ -1749,6 +1788,11 @@ def max_independent_vertex_set(g, high_deg=False, mivs=None):
>>> gt.graph_draw(g, vertex_fill_color=res, output="mivs.pdf")
<...>
.. testcode::
:hide:
gt.graph_draw(g, vertex_fill_color=res, output="mivs.png")
.. figure:: mivs.*
:align: center
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment