Package networkx :: Module io
[frames | no frames]

Module networkx.io

Read and write graphs and networks.

The example undirected graph below consists of the two edges (a,b),(a,c).


Function Summary
  read_adjlist(path, create_using)
Read graph in single line adjacency list format from path.
  read_edgelist(path, create_using)
Read graph in edgelist format
  read_gpickle(path)
Read graph object in python pickle format See cPickle.
  read_multiline_adjlist(path, create_using)
Read graph in multiline adjacency list format.
  write_adjlist(G, path)
Write graph in single line adjacency list format in file path.
  write_edgelist(G, path)
Write graph G in edgelist format on file path.
  write_gpickle(G, path)
Write graph object in python pickle format See cPickle.
  write_multiline_adjlist(G, path)
Write graph in multiline adjacency list format.

Variable Summary
str __author__ = 'Aric Hagberg (hagberg@lanl.gov)\nDan Schul...
str __credits__ = ''
str __date__ = '$Date: 2005-07-06 07:58:26 -0600 (Wed, 06 Ju...
str __revision__ = '$Revision: 1063 $'

Function Details

read_adjlist(path=False, create_using=None)

Read graph in single line adjacency list format from path. The default is to create a simple graph from the adjacency list. The optional create_using argument allows other types of graphs.

>>> G=DiGraph()
>>> G=read_adjlist(file, create_using=G)

Example adjacency list file format:

# node degree
a b c
b a
c a

read_edgelist(path=False, create_using=None)

Read graph in edgelist format

Example adjacency list file format:

# node degree
a b
a c

read_gpickle(path=False)

Read graph object in python pickle format See cPickle.

read_multiline_adjlist(path=False, create_using=None)

Read graph in multiline adjacency list format.

Example multiline adjacency list file format:

# node degree
a 2
b
c
b 1
a
c 1
a

write_adjlist(G, path=False)

Write graph in single line adjacency list format in file path.

If no file is given, write to standard output.

Example adjacency list file format:

# node degree
a b c
b a
c a

write_edgelist(G, path=False)

Write graph G in edgelist format on file path.

If no file is given write to standard output.

Example adjacency list file format:

# node degree
a b
a c

write_gpickle(G, path=False)

Write graph object in python pickle format See cPickle.

write_multiline_adjlist(G, path=False)

Write graph in multiline adjacency list format.

Example multiline adjacency list file format:

# node degree
a 2
b
c
b 1
a
c 1
a

Variable Details

__author__

Type:
str
Value:
'''Aric Hagberg (hagberg@lanl.gov)
Dan Schult (dschult@colgate.edu)'''                                    

__credits__

Type:
str
Value:
''                                                                     

__date__

Type:
str
Value:
'$Date: 2005-07-06 07:58:26 -0600 (Wed, 06 Jul 2005) $'                

__revision__

Type:
str
Value:
'$Revision: 1063 $'                                                    

Generated by Epydoc 2.1 on Sun Aug 21 08:06:58 2005 http://epydoc.sf.net