用python字典生成gephi上的朋友图

2024-05-16 00:46:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用吉非(http://gephi.org/)生成朋友地图。当前,我的数据存储在一个字典中,它看起来像:

{id1 : [friend_id, friend_id2 etc],
id2 : [friend_id3],
id3 : ... }

gephi需要什么样的数据结构来绘制这样的图形 https://gephi.org/wp-content/themes/gephi/images/screenshots/layout2-mini.png

非常感谢!在


Tags: 数据orgfriendidhttp数据结构字典地图
1条回答
网友
1楼 · 发布于 2024-05-16 00:46:17

你可以在多个选项中选择。最简单的方法是使用Excel图表并将其保存为CSV。 在第一列中输入person1id,在第2列中输入person2id:

 person1id  person2id
 Adam       Maria
 Maria      Ben
 Ben        Adam

您也可以使用以下任何格式:https://gephi.org/users/supported-graph-formats/ 从数据中最容易生成的可能是GML或GraphML。在

另请参阅我在这个问题上的回答,该问题概述了如何使用GML:Data structure for visualizing organizations and individuals using Gephi?

相关问题 更多 >