Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / examples / pygraphviz / plot_pygraphviz_draw.py @ 5cef0f13

History | View | Annotate | Download (750 Bytes)

1
#!/usr/bin/env python
2
"""
3
===============
4
Pygraphviz Draw
5
===============
6

7
An example showing how to use the interface to the pygraphviz
8
AGraph class to draw a graph.
9

10
Also see the pygraphviz documentation and examples at
11
http://pygraphviz.github.io/
12
"""
13
# Author: Aric Hagberg (hagberg@lanl.gov)
14

    
15
#    Copyright (C) 2006-2019 by
16
#    Aric Hagberg <hagberg@lanl.gov>
17
#    Dan Schult <dschult@colgate.edu>
18
#    Pieter Swart <swart@lanl.gov>
19
#    All rights reserved.
20
#    BSD license.
21

    
22
import networkx as nx
23

    
24
# plain graph
25

    
26
G = nx.complete_graph(5)   # start with K5 in networkx
27
A = nx.nx_agraph.to_agraph(G)        # convert to a graphviz graph
28
A.layout()            # neato layout
29
A.draw("k5.ps")       # write postscript in k5.ps with neato layout