~ubuntu-branches/ubuntu/trusty/python-networkx/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/graph/atlas2.py

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2009-02-28 13:36:24 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090228133624-9l5rwi1ftlzc7b0l
* Upload to unstable now that lenny is released (yay).
* Fix FTBFS with python-support 0.90.3: no longer rely on its internal
  behaviour, and xnow set tests/test.py executable right after “setup.py
  install” (Closes: #517065).
* Drop executable bits from bz2 files.
* Update Vcs-* fields: move from DPMT's svn to collab-maint's git.
* Remote DPMT from Uploaders, following Piotr Ożarowski's request.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""
 
3
Write first 20 graphs from the graph atlas as graphviz dot files
 
4
Gn.dot where n=0,19.
 
5
Requires pygraphviz and graphviz.
 
6
"""
 
7
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
 
8
__date__ = "$Date: 2005-05-19 14:23:02 -0600 (Thu, 19 May 2005) $"
 
9
__credits__ = """"""
 
10
__revision__ = ""
 
11
#    Copyright (C) 2006 by 
 
12
#    Aric Hagberg <hagberg@lanl.gov>
 
13
#    Dan Schult <dschult@colgate.edu>
 
14
#    Pieter Swart <swart@lanl.gov>
 
15
#    Distributed under the terms of the GNU Lesser General Public License
 
16
#    http://www.gnu.org/copyleft/lesser.html
 
17
 
 
18
import networkx as NX
 
19
from networkx.generators.atlas import *
 
20
from pygraphviz import *
 
21
 
 
22
atlas=graph_atlas_g()[0:20]
 
23
 
 
24
 
 
25
for G in atlas:
 
26
    print "graph %s has %d nodes with %d edges"\
 
27
          %(G.name,NX.number_of_nodes(G),NX.number_of_edges(G))
 
28
    A=NX.to_agraph(G)
 
29
    A.graph_attr['label']=G.name 
 
30
    # set default node attributes
 
31
    A.node_attr['color']='red'
 
32
    A.node_attr['style']='filled'
 
33
    A.node_attr['shape']='circle'
 
34
    A.write(G.name+'.dot')