Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graphtool
Commits
9c5e0b16
Commit
9c5e0b16
authored
May 20, 2010
by
Tiago Peixoto
Browse files
Small documentation fixes and updates
parent
8ecad8f5
Changes
6
Hide whitespace changes
Inline
Sidebyside
doc/.static/graphicon.ico
View replaced file @
8ecad8f5
View file @
9c5e0b16
1022 Bytes

W:

H:
1.25 KB

W:

H:
2up
Swipe
Onion skin
doc/conf.py
View file @
9c5e0b16
...
...
@@ 44,7 +44,7 @@ master_doc = 'index'
# General information about the project.
project
=
u
'graphtool'
copyright
=
u
'200
9
, Tiago de Paula Peixoto <tiago@forked.de>'
copyright
=
u
'20
1
0, Tiago de Paula Peixoto <tiago@forked.de>'
# The version info for the project you're documenting, acts as replacement for
# version and release, also used in various other places throughout the
...
...
doc/price.py
View file @
9c5e0b16
...
...
@@ 10,7 +10,7 @@ seed(42)
from
graph_tool.all
import
*
# let's construct a Price network (the one that existed before Barabasi). It is
# a directed network, with preferential attachment. The algorithm below is
a
# a directed network, with preferential attachment. The algorithm below is
# very naive, and a bit slow, but quite simple.
# We start with an empty, directed graph
...
...
@@ 64,7 +64,7 @@ gca().set_ylim(1e1,1e5)
gca
().
set_xlim
(
0.8
,
1e3
)
subplots_adjust
(
left
=
0.2
,
bottom
=
0.2
)
xlabel
(
"$k_{in}$"
)
ylabel
(
"$P(k_{in})$"
)
ylabel
(
"$
N
P(k_{in})$"
)
savefig
(
"deghist.png"
)
# let's do a random walk on the graph and print the age of the vertices we find,
...
...
@@ 84,7 +84,7 @@ for i in xrange(0, 100):
n_list
.
append
(
w
)
v
=
n_list
[
randint
(
0
,
len
(
n_list
))]
# let's save our graph for posterity We want to save the age properties as
# let's save our graph for posterity
.
We want to save the age properties as
# well... To do this, they must become "internal" properties, as such:
g
.
vertex_properties
[
"age"
]
=
v_age
...
...
doc/quickstart.rst
View file @
9c5e0b16
...
...
@@ 261,6 +261,9 @@ method, i.e.,
# this assigns random values to the properties
vprop_double.get_array()[:] = random(g.num_vertices())
# or more conveniently (this is equivalent to the above)
vprop_double.a = random(g.num_vertices())
Internal property maps
++++++++++++++++++++++
...
...
@@ 302,7 +305,7 @@ filelike object. A graph can also be loaded from disk with the
# ... fill the graph ...
g.save("my_graph.xml.gz")
g2 = load_graph("my_graph.xml.gz")
# g and g2 should be
a
cop
y
of each other
# g and g2 should be cop
ies
of each other
Graph classes can also be pickled with the :mod:`pickle` module.
...
...
@@ 313,9 +316,9 @@ An Example: Building a Price Network
A Price network is the first known model of a "scalefree" graph, invented in
1976 by `de Solla Price
<http://en.wikipedia.org/wiki/Derek_J._de_Solla_Price>`_. It is defined
dynamically,
and
at each time step a new vertex is added to the graph, and
dynamically,
where
at each time step a new vertex is added to the graph, and
connected to an old vertex, with probability proportional to its indegree. The
following program implements this construction
method
using ``graphtool``.
following program implements this construction using ``graphtool``.
.. literalinclude:: price.py
:linenos:
...
...
@@ 342,7 +345,7 @@ The following is what should happen when the program is run.
vertex: 0 indegree: 210 outdegree: 0 age: 0
Nowhere else to go... We found the main hub!
This is the degree distribution, with 100000 nodes. If you want to
really see a
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`.
...
...
@@ 367,10 +370,10 @@ use the :func:`~graph_tool.draw.graph_draw` function.
Graph filtering

One of the very nice features f
rom
``graphtool`` is the "onthefly" filtering
of
edges and/or vertices. Filtering means the temporary masking of
vertices/edges,
which are not really removed, and can be easily
recovered. Vertices or
edges which are to be filtered should be marked with a
One of the very nice features
o
f ``graphtool`` is the "onthefly" filtering
of
edges and/or vertices. Filtering means the temporary masking of
vertices/edges,
which are
in fact
not really removed, and can be easily
recovered. Vertices or
edges which are to be filtered should be marked with a
:class:`~graph_tool.PropertyMap` with value type ``bool``, and then set with
:meth:`~graph_tool.Graph.set_vertex_filter` or
:meth:`~graph_tool.Graph.set_edge_filter` methods. By default, vertex or edges
...
...
src/graph_tool/__init__.py
View file @
9c5e0b16
...
...
@@ 51,7 +51,7 @@ Use the builtin ``help`` function to view a function's docstring::
>>> help(gt.Graph)
Classes
Summary

.. autosummary::
...
...
@@ 67,6 +67,8 @@ Classes
value_types
show_config
Classes

"""
__author__
=
"Tiago de Paula Peixoto <tiago@forked.de>"
...
...
src/graph_tool/generation/__init__.py
View file @
9c5e0b16
...
...
@@ 293,7 +293,7 @@ def random_rewire(g, strat="uncorrelated", parallel_edges=False,
Notes

This algorithm iterates through all the edges in the network and tries to
swap its target o
ur edge with
another edge.
swap its target o
r source with the target or source of
another edge.
.. note::
If `parallel_edges` = False, parallel edges are not placed during
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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