如何从Python创建Gephi网络图? [英] How to create Gephi network graphs from Python?

查看:1276
本文介绍了如何从Python创建Gephi网络图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现有关GephiStreamer的信息. https://pypi.python.org/pypi/GephiStreamer

I have just found out about GephiStreamer. https://pypi.python.org/pypi/GephiStreamer

使用此程序包可以将指令从python发送到Gephi,以在Gephi中创建节点和边.

Using this package one can send instructions from python to Gephi to create nodes and edges in Gephi.

# Create a node with a custom_property
node_a = graph.Node("A",custom_property=1)

# Create edge 
edge_ab = graph.Edge(node_a,node_b,custom_property="hello")
stream.add_edge(edge_ab)

类似地,我想通过Python在Gephi中完成所有操作.这是我通常的工作.

Similarly I want to do everything in Gephi through Python. Here is what I typically do.

例如:

步骤:

  1. 加载节点

  1. load nodes

加载边缘

计算它们之间的中心度

根据节点的中心度得分更改其大小/颜色

change the size/color of nodes as per their centrality scores

更改图形布局(例如forceatlas2)

change the graph layout (such as forceatlas2)

给出输出图

下面是我手动获得的输出,但是我想通过将指令从python发送到Gephi来产生相同的输出.除了创建节点,边和图形之外,文档没有任何其他内容.

Below is the output I have got manually, but I want to produce the same by sending instructions from python to Gephi. Documentation doesn't tell anything beyond creating nodes, edges and graphs.

我还发现了有关NetworKit的信息. https://networkit.iti.kit .edu/data/uploads/docs/NetworKit-Doc/python/html/gephi.html

I have also found out about NetworKit. https://networkit.iti.kit.edu/data/uploads/docs/NetworKit-Doc/python/html/gephi.html

这比gephistramer稍好,但这需要python 3.4或更高版本,并且大多数软件包(如pandas,numpy或生病)都在2.7中.

This is slightly better than gephistramer, but this requires python 3.4 or higher and most of the packages like pandas, numpy or sickit are in 2.7.

还有一种方法可以将我在gephi中创建的文件发送回python.

also Is there a way to send the file I have created in gephi back to python.

请提出建议.

PS:我已经编辑了整个问题的详细信息,以便现在(希望如此)更容易理解.

PS: I have edited the entire question details so that it's easier to understand now (hopefully).

推荐答案

我在寻找答案时发现了这个问题.我选择了Gephi作为可视化工具,然后希望通过使用Python从我的组织中提取数据来构建该工具很好支持的图形.

I found this question while looking for the answer myself. I picked Gephi as my visualizer and then wanted to build a graph that was well supported by the tool by pulling data from around my org with Python.

我找到了 GephiStreamer ,它看起来是一种简单而全面的方法,可以从外部python环境(命令行或IDE)

I found GephiStreamer and it looks a simple yet comprehensive way to build graphs in Gephi from an external python environment (command line, or IDE)

这时的其他选项是:

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