NetworkX

Previous topic

networkx.parse_pajek

Next topic

networkx.write_pajek

networkx.read_pajek

read_pajek(path)

Read graph in Pajek format from path.

Returns a MultiGraph or MultiDiGraph.

Parameters:

path : file or string

File or filename to write. Filenames ending in .gz or .bz2 will be compressed.

Examples

>>> G=nx.path_graph(4)
>>> nx.write_pajek(G, "test.net")
>>> G=nx.read_pajek("test.net")

To create a Graph instead of a MultiGraph use

>>> G1=nx.Graph(G)