提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
- 前言
- 一、什么是社交网络?
- 二、社交网络数据集
- 代码展示
- 三、其他网络数据集
- 1.Fujiki Y, Yakubo K. Identification of intrinsic long-range degree correlations in complex networks[J]. Physical Review E, 2020, 101(3): 032308.
- 代码
- 2.Chen D, Su H, Wang X, et al. Finite-size scaling of geometric renormalization flows in complex networks[J]. Physical Review E, 2021, 104(3): 034304.
- 文章地址
- 数据来源
- 总结
前言
提示:这里可以添加本文要记录的大概内容:
目前很多科研需要用到复杂网络数据集,在本文中提供了来自已发论文中使用到的真实网络数据集,并且提供简单的python脚本构建每个数据对应的网络结构。
提示:以下是本篇文章正文内容,下面案例可供参考
一、什么是社交网络?
社交网络是指通过互联网或其他信息技术手段建立起来的、基于个人或组织之间相互联系和交流的平台。它允许用户创建个人资料、分享信息、发布内容、与他人建立联系,并参与各种社交活动,如聊天、评论、点赞等。社交网络的核心是构建人际关系和扩大社交圈子,通过在线平台将人们连接起来,促进信息传播和社交互动。常见的社交网络包括Facebook、Twitter、Instagram等。社交网络的应用领域广泛,涵盖了个人社交、商业推广、信息传播、娱乐等方面。
二、社交网络数据集
1.产品评价网络(Epinions)
Epinions是一个产品评论者网络。
网站上的每个用户都可以发布任何产品的评论,其他用户会对评论进行信任或不信任。在这些数据中,我们创建了一个与信任和不信任关系相关的审稿人网络。该数据集由 131828 个用户和 841372 个关系组成,其中约 85.0% 是信任关系。数据集可用于推断用户之间的信任关系。
1表示信任,-1表示不信任
person id | person id | relationship type |
---|---|---|
0 | 1 | -1 |
4 | 2281 | 1 |
// @Author:Max
import networkx as nx
import pandas as pd
dates = pd.read_csv('epinions.txt',delimiter='\t',header=None)
//读取前两列
df=dates.iloc[1:, :2]
df.to_csv('epinions1.txt',sep=' ',index=0,header=0)
G = nx.read_edgelist('epinions.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
print(G)
2.斜杠关系网络
Slashdot是一个朋友网络。Slashdot是一个分享技术相关新闻的网站。2002年,Slashdot推出了Slashdot动物园,允许用户将彼此标记为“朋友”(喜欢)或“敌人”(不喜欢)。
该数据集由77357个用户和516575个关系组成,其中76.7%是“朋友”关系。该数据集可用于推断用户之间的“朋友”关系,并研究积极和消极的影响。、
1表示朋友关系、 -1表示敌人关系 前两个为id号
id | id | relationship type |
---|---|---|
0 | 1 | -1 |
0 | 22 | 1 |
// @Author:Max
import networkx as nx
import pandas as pd
dates = pd.read_csv('Slashdot.txt',delimiter='\t',header=None)
//读取前两列
df=dates.iloc[1:, :2]
df.to_csv('epinions1.txt',sep=' ',index=0,header=0)
G = nx.read_edgelist('epinions.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
print(G)
3.演员网络
基于 2004 年 imdb 数据。节点代表演员,如果相应的演员一起制作了至少一部电影,则连接两个节点。专为电视制作、直接转视频和视频游戏的参赛作品已被移除。预处理数据由Hawoong Jeong提供。id1代表演员序号,id2代表演员序号。
id | id |
---|---|
0 | 97500 |
0 | 290039 |
// @Author:Max
import networkx as nx
G = nx.read_edgelist('actor.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
print(G)
4.协作网络
基于arXiv预印本档案的凝聚物物理类别的科学合作网络,涵盖1993年2003月至2007年1月期间。每个节点代表一个作者,如果两个节点在数据集中共同创作了至少一篇论文,则两个节点将连接起来。
5.电话网
节点代表手机用户的样本,如果他们在观察期间至少互相呼叫过一次,它们就会连接。数据集包含来自(Song et al, 2010)的最活跃用户的子集。数据由宋朝明提供。
6.引用网
APS期刊的引用网络(物理评论快报,物理评论和现代物理学评论)。每个节点代表一篇论文,如果 A 引用 B,则有一个定向链接将节点 A 连接到节点 B。
7.电子邮件
电子邮件网络基于德国基尔大学 112 天收集的流量数据。每个节点都是一个电子邮件地址,如果 A 向 B 发送了至少一封电子邮件,则从节点 A 到节点 B 有一个定向链接。
8.万维网
节点表示域 nd.edu 下圣母大学的网页,定向链接表示它们之间的超链接。1999年收集的数据。
代码展示
// @Author:Max
import networkx as nx
//协作网络数据
G = nx.read_edgelist('collaboration.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
//电话网络数据
G = nx.read_edgelist('phonecalls.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
//引用网络数据
G = nx.read_edgelist('citation.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
//电子邮件数据
G = nx.read_edgelist('email.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
//万维网
G = nx.read_edgelist('internet.edgelist.txt', delimiter=' ', create_using=nx.DiGraph(), nodetype=str)
print(G)
三、其他网络数据集
1.Fujiki Y, Yakubo K. Identification of intrinsic long-range degree correlations in complex networks[J]. Physical Review E, 2020, 101(3): 032308.
代码
// @Author:Max
import networkx as nx
# All the following networks are regarded as undirected networks
G = nx.read_edgelist('p2p-Gnutella04.txt', comments='#', create_using=nx.Graph())
# G = nx.read_edgelist('Internet (AS level) (1).txt', create_using=nx.Graph())
# G = nx.read_edgelist('Internet (AS level) (2).txt', comments='%', create_using=nx.Graph())
# G = nx.read_gml('as-22july06.gml')
# G = nx.read_edgelist('Google+ (NIPS).txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('Email-Enron.txt', comments='#', create_using=nx.Graph())
# G = nx.read_edgelist('web-baidu-baike-related.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('brightkite_edges.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('facebook-wosn-links.txt', comments='%', create_using=nx.Graph(), data=False)
# G = nx.read_edgelist('ca-AstroPh.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('youtube.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('Coauthor (2).txt', comments='#', create_using=nx.Graph())
# G = nx.read_edgelist('Actor.txt', create_using=nx.Graph())
# G = nx.read_edgelist('CA-CondMat.txt', comments='#', create_using=nx.Graph())
# G = nx.read_edgelist('ego-twitter.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('WWW (2).txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('Internet (router level).txt', create_using=nx.Graph())
# G = nx.read_edgelist('web-Stanford.txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('WWW (4).txt', comments='%', create_using=nx.Graph())
# G = nx.read_edgelist('Protein folding.txt', comments='#', create_using=nx.Graph(), data=False)
# G = nx.read_edgelist('amazon.txt', comments='%', create_using=nx.Graph())
2.Chen D, Su H, Wang X, et al. Finite-size scaling of geometric renormalization flows in complex networks[J]. Physical Review E, 2021, 104(3): 034304.
文章地址
数据来源
Gnutella:http://snap.stanford.edu/data/
AS:http://snap.stanford.edu/data/as.html
CAIDA:http://snap.stanford.edu/data/as-caida.html
Cond-Mat:
http://www-personal.umich.edu/~mejn/netdata/
Socfb:https://networkrepository.com/socfb
IG5、TF、Rajat、Cage、Maragal:
https://networkrepository.com/misc.php
总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了复杂网络数据以及社交网络数据集来源。