问题
I'm recently working on constructing social network graphs using networkX. I'm able to visualize and manipulate the graph at small scale. Howerver Im interested in knowing where networkX stores this graph info. This is because, I'm having a large collection of users for whom I need to construct graph and use the graph info for some suggestions. So I would like to know if I could store and access the graph.
回答1:
NetworkX stores graph data in Python objects instantiated from one of several NetworkX classes. You choose the NetworkX class to use based on the type of graph you want to create. NetworkX graph classes include Graph, DiGraph, MultiGraph, and MultiDiGraph. See the NetworkX Documentation on Graph Types for more information on these classes.
For persistent storage of NetworkX graph objects, you have many options. You could pickle the Python object, or export to and import from a number of different formats, including GML, GraphML, and JSON. For more information see the NetworkX Documentation on Reading and Writing Graphs.
来源:https://stackoverflow.com/questions/32542058/networkx-storage-of-graph-info