Skip to content
GitLab
Menu
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
af0cad81
Commit
af0cad81
authored
Jan 18, 2011
by
Tiago Peixoto
Browse files
Improve documentation for topology module
parent
db308330
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/topology/__init__.py
View file @
af0cad81
...
...
@@ -19,8 +19,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
``graph_tool.topology`` -
Topology related functions
----------------------------------------------------
``graph_tool.topology`` -
Important functions for assessing graph topology
----------------------------------------------------
----------------------
Summary
+++++++
...
...
@@ -43,6 +43,7 @@ Summary
Contents
++++++++
"""
from
..
dl_import
import
dl_import
...
...
@@ -233,23 +234,22 @@ def min_spanning_tree(g, weights=None, root=None, tree_map=None):
--------
>>> from numpy.random import seed
>>> seed(42)
>>> g = gt.random_graph(100, lambda: (5, 5))
>>> tree = gt.min_spanning_tree(g)
>>> print tree.a
[0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 1
0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0
1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0
1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1
0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0
0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
>>> g, pos = gt.triangulation(random((400, 2)) * 10, type="delaunay")
>>> weight = g.new_edge_property("double")
>>> for e in g.edges():
... weight[e] = norm(pos[e.target()].a - pos[e.source()].a)
>>> tree = gt.min_spanning_tree(g, weights=weight)
>>> graph_draw(g, pos=pos, pin=True, output="triang_orig.png")
<...>
>>> g.set_edge_filter(tree)
>>> graph_draw(g, pos=pos, pin=True, output="triang_min_span_tree.png")
<...>
.. image:: triang_orig.png
.. image:: triang_orig_span_tree.png
*Left:* Original graph, *Right:* The minimum spanning tree.
References
----------
...
...
@@ -864,7 +864,7 @@ def is_planar(g, embedding=False, kuratowski=False):
>>> print p
False
>>> g.set_edge_filter(kur, True)
>>> gt.graph_draw(g,
layout="arf", size=(7,7),
output="kuratowski.png")
>>> gt.graph_draw(g, output="kuratowski.png")
<...>
.. figure:: kuratowski.png
...
...
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