Commit 9c5e0b16 authored by Tiago Peixoto's avatar Tiago Peixoto

Small documentation fixes and updates

parent 8ecad8f5
doc/.static/graph-icon.ico

1022 Bytes | W: | H:

doc/.static/graph-icon.ico

1.25 KB | W: | H:

doc/.static/graph-icon.ico
doc/.static/graph-icon.ico
doc/.static/graph-icon.ico
doc/.static/graph-icon.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -44,7 +44,7 @@ master_doc = 'index'
# General information about the project.
project = u'graph-tool'
copyright = u'2009, Tiago de Paula Peixoto <tiago@forked.de>'
copyright = u'2010, 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
......
......@@ -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(1e-1,1e5)
gca().set_xlim(0.8,1e3)
subplots_adjust(left=0.2,bottom=0.2)
xlabel("$k_{in}$")
ylabel("$P(k_{in})$")
ylabel("$NP(k_{in})$")
savefig("deg-hist.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
......
......@@ -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 @@ file-like 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 copy of each other
# g and g2 should be copies 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 "scale-free" 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 in-degree. The
following program implements this construction method using ``graph-tool``.
following program implements this construction using ``graph-tool``.
.. literalinclude:: price.py
:linenos:
......@@ -342,7 +345,7 @@ The following is what should happen when the program is run.
vertex: 0 in-degree: 210 out-degree: 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 from ``graph-tool`` is the "on-the-fly" 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 of ``graph-tool`` is the "on-the-fly" 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
......
......@@ -51,7 +51,7 @@ Use the built-in ``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>"
......
......@@ -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 our edge with another edge.
swap its target or source with the target or source of another edge.
.. note::
If `parallel_edges` = False, parallel edges are not placed during
......
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