NetworkX存储图信息 [英] NetworkX storage of graph info

查看:119
本文介绍了NetworkX存储图信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近正在使用networkX构建社交网络图.我能够以小规模可视化和操作图形.Howerver Im有兴趣了解networkX在何处存储此图形信息.这是因为,我有大量的用户,他们需要为其构建图形并将图形信息用于一些建议.因此,我想知道是否可以存储和访问该图.

解决方案

NetworkX将图形数据存储在从多个NetworkX类之一实例化的Python对象中.您可以根据要创建的图形类型选择要使用的NetworkX类.NetworkX图形类包括Graph,DiGraph,MultiGraph和MultiDiGraph.有关这些类的更多信息,请参见关于图形类型的NetworkX文档.

对于NetworkX图形对象的持久存储,您有很多选择.您可以腌制Python对象,也可以导出到多种不同格式并从其中导入,包括GML,GraphML和JSON.有关更多信息,请参见有关读写图的NetworkX文档./p>

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.

解决方案

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.

这篇关于NetworkX存储图信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆