Cora.cite数据集
cora.cite数据集下载地址:https://linqs-data.soe.ucsc.edu/public/lbc/cora.tgz
GCN数据集:
元组列表的遍历:
https://blog.csdn.net/sinat_38068807/article/details/85309093
networkx求解网络的各种特征:
一、度、度分布
NetworkX可以用来统计图中每个节点的度,并生成度分布序列。下边是一段示例代码(这段代码可以在Shell里一行一行的输入,也可以将其保存为一个以py结尾的纯文本文件后直接运行),注意看注释部分:
import networkx as nx
G = nx.random_graphs.barabasi_albert_graph(1000,3) #生成一个n=1000,m=3的BA无标度网络
print G.degree(0) #返回某个节点的度
print G.degree() #返回所有节点的度
print nx.degree_histogram(G) #返回图中所有节点的度分布序列(从1至最大度的出现频次)
对上述结果稍作处理,就可以在Origin等软件里绘制度分布曲线了,当然也可以用matplotlib直接作图,在上述代码后接着输入:
import matplotlib.pyplot as plt #导入科学绘图的matplotlib包
degree = nx.degree_histogram(G) #返回图中所有节点的度分布序列
x = range(len(degree)) #生成x轴序列,从1到最大度
y = [z / float(sum(degree)) for z in degree]
#将频次转换为频率,这用到Python的一个小技巧:列表内涵,Python的确很方便:)
plt.loglog(x,y,color="blue",linewidth=2) #在双对数坐标轴上绘制度分布曲线
plt.show() #显示图表
networkx求最大连通分量:
https://blog.csdn.net/qq_36148333/article/details/107065194
H = list(G.subgraph(c) for c in nx.connected_components(G))[0]
https://blog.csdn.net/woody1982130/article/details/53471681 python2.x版本
networkx计算网络的最短路径,平均最短路径,网络的效率
https://blog.csdn.net/tengqingyong/article/details/88619779
networkx复杂网络分析参考:
https://blog.csdn.net/ztf312/article/details/107711916
https://blog.csdn.net/tengqingyong/article/details/88619779

浙公网安备 33010602011771号