networkx.readwrite

A package for reading and writing graphs in various formats.

Functions

adjacency_data(G[, attrs]) Return data in adjacency format that is suitable for JSON serialization and use in Javascript documents.
adjacency_graph(data[, directed, ...]) Return graph from adjacency data format.
generate_adjlist(G[, delimiter]) Generate a single line of the graph G in adjacency list format.
generate_edgelist(G[, delimiter, data]) Generate a single line of the graph G in edge list format.
generate_gexf(G[, encoding, prettyprint, ...]) Generate lines of GEXF format representation of G.
generate_gml(G[, stringizer]) Generate a single entry of the graph G in GML format.
generate_graph6(G[, nodes, header]) Generate graph6 format string from a simple undirected graph.
generate_graphml(G[, encoding, prettyprint]) Generate GraphML lines for G
generate_multiline_adjlist(G[, delimiter]) Generate a single line of the graph G in multiline adjacency list format.
generate_pajek(G) Generate lines in Pajek graph format.
generate_sparse6(G[, nodes, header]) Generate sparse6 format string from an undirected graph.
jit_data(G[, indent]) Return data in JIT JSON format.
jit_graph(data) Read a graph from JIT JSON.
node_link_data(G[, attrs]) Return data in node-link format that is suitable for JSON serialization and use in Javascript documents.
node_link_graph(data[, directed, ...]) Return graph from node-link data format.
parse_adjlist(lines[, comments, delimiter, ...]) Parse lines of a graph adjacency list representation.
parse_edgelist(lines[, comments, delimiter, ...]) Parse lines of an edge list representation of a graph.
parse_gml(lines[, label, destringizer]) Parse GML graph from a string or iterable.
parse_graph6(string) Read a simple undirected graph in graph6 format from string.
parse_graphml(graphml_string[, node_type]) Read graph in GraphML format from string.
parse_leda(lines) Read graph in LEDA format from string or iterable.
parse_multiline_adjlist(lines[, comments, ...]) Parse lines of a multiline adjacency list representation of a graph.
parse_pajek(lines) Parse Pajek format graph from string or iterable.
parse_sparse6(string) Read an undirected graph in sparse6 format from string.
read_adjlist(path[, comments, delimiter, ...]) Read graph in adjacency list format from path.
read_edgelist(path[, comments, delimiter, ...]) Read a graph from a list of edges.
read_gexf(path[, node_type, relabel, version]) Read graph in GEXF format from path.
read_gml(path[, label, destringizer]) Read graph in GML format from path.
read_gpickle(path) Read graph object in Python pickle format.
read_graph6(path) Read simple undirected graphs in graph6 format from path.
read_graphml(path[, node_type]) Read graph in GraphML format from path.
read_leda(path[, encoding]) Read graph in LEDA format from path.
read_multiline_adjlist(path[, comments, ...]) Read graph in multi-line adjacency list format from path.
read_pajek(path[, encoding]) Read graph in Pajek format from path.
read_shp(path[, simplify, geom_attrs]) Generates a networkx.DiGraph from shapefiles.
read_sparse6(path) Read an undirected graph in sparse6 format from path.
read_weighted_edgelist(path[, comments, ...]) Read a graph as list of edges with numeric weights.
read_yaml(path) Read graph in YAML format from path.
relabel_gexf_graph(G) Relabel graph using “label” node keyword for node label.
tree_data(G, root[, attrs]) Return data in tree format that is suitable for JSON serialization and use in Javascript documents.
tree_graph(data[, attrs]) Return graph from tree data format.
write_adjlist(G, path[, comments, ...]) Write graph G in single-line adjacency-list format to path.
write_edgelist(G, path[, comments, ...]) Write graph as a list of edges.
write_gexf(G, path[, encoding, prettyprint, ...]) Write G in GEXF format to path.
write_gml(G, path[, stringizer]) Write a graph G in GML format to the file or file handle path.
write_gpickle(G, path[, protocol]) Write graph in Python pickle format.
write_graph6(G, path[, nodes, header]) Write a simple undirected graph to path in graph6 format.
write_graphml(G, path[, encoding, ...]) Write G in GraphML XML format to path
write_multiline_adjlist(G, path[, ...]) Write the graph G in multiline adjacency list format to path
write_pajek(G, path[, encoding]) Write graph in Pajek format to path.
write_shp(G, outdir) Writes a networkx.DiGraph to two shapefiles, edges and nodes.
write_sparse6(G, path[, nodes, header]) Write graph G to given path in sparse6 format.
write_weighted_edgelist(G, path[, comments, ...]) Write graph G as a list of edges with numeric weights.
write_yaml(G, path[, encoding]) Write graph G in YAML format to path.

Classes

GraphMLReader([node_type]) Read a GraphML document.
GraphMLWriter([graph, encoding, ...])