networkx graph save and load

Generate and parse JSON serializable data for NetworkX graphs.

node_link_data(G[, attrs]) Returns data in node-link format that is suitable for JSON serialization and use in Javascript documents.
node_link_graph(data[, directed, …]) Returns graph from node-link data format.
adjacency_data(G[, attrs]) Returns data in adjacency format that is suitable for JSON serialization and use in Javascript documents.
adjacency_graph(data[, directed, …]) Returns graph from adjacency data format.
cytoscape_data(G[, attrs]) Returns data in Cytoscape JSON format (cyjs).
cytoscape_graph(data[, attrs])  
tree_data(G, root[, attrs]) Returns data in tree format that is suitable for JSON serialization and use in Javascript documents.
tree_graph(data[, attrs]) Returns graph from tree data format.
jit_data(G[, indent]) Returns data in JIT JSON format.
jit_graph(data[, create_using]) Read a graph from JIT JSON.
json.dump(data, open(file, 'w'), indent=2)
原文地址:https://www.cnblogs.com/dulun/p/11672846.html