利用python绘制热图、计算网络节点degree、kshell、介数中心性、接近中心性、特征向量中心性、PageRank,计算相关性含环境、代码、数据源
利用python绘制热图、计算网络节点degree、kshell、介数中心性、接近中心性、特征向量中心性、PageRank,计算相关性含环境、代码、数据源
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5107 2017-05-12 12:27 python环境、代码及数据代码DrawHeatMap.py
文件 7416 2017-05-10 18:38 python环境、代码及数据其他不相关output1.csv
文件 1381985 2017-05-10 18:41 python环境、代码及数据其他不相关
esult_merged.csv
文件 8221 2017-05-04 19:46 python环境、代码及数据其他不相关代码CalCorrelation1_9_S.py
文件 2639 2017-05-11 17:33 python环境、代码及数据其他不相关代码Cal_DKBCEP.py
文件 1781978 2017-04-27 16:47 python环境、代码及数据其他不相关代码python_igraph-0.7.1.post6-cp27-none-win_amd64.whl
文件 407 2017-05-12 14:48 python环境、代码及数据其他不相关说明.txt
文件 2973 2017-05-10 18:41 python环境、代码及数据数据文件
esult_f_distribution.csv
文件 0 2017-05-12 14:41 python环境、代码及数据新建文本文档.txt
文件 6140635 2017-01-15 10:17 python环境、代码及数据环境matplotlib-1.5.3-cp27-cp27m-win_amd64.whl
文件 32997908 2017-01-15 09:35 python环境、代码及数据环境
umpy-1.11.3+mkl-cp27-cp27m-win_amd64.whl
文件 19382272 2017-01-14 21:53 python环境、代码及数据环境python-2.7.10.amd64.msi
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关代码
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关包
目录 0 2017-05-12 14:29 python环境、代码及数据代码
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关
目录 0 2017-05-12 14:29 python环境、代码及数据数据文件
目录 0 2017-05-12 14:49 python环境、代码及数据环境
目录 0 2017-05-12 14:41 python环境、代码及数据
----------- --------- ---------- ----- ----
61711541 19
‘‘‘
Created on 20170511
@author: Cherry
‘‘‘
import csv
from matplotlib import cm
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib.ticker import FormatStrFormatter
from matplotlib.pyplot import savefig
degrees = []
kshells = []
upper_values = []
eu_values = []
el_values = []
lower_values = []
root = ‘D:/Cherry/data/netsci‘
dataPath = root + ‘/result_f_distribution.csv‘
def readData():
with open(dataPath ‘r‘) as f:
i = 0
for row in csv.reader(f.read().splitlines()):
if i == 0:
i += 1
else:
id kshell degree upper eu el lower = [i for i in row]
degrees.append(degree)
kshells.append(kshell)
upper_values.append(upper)
eu_values.append(eu)
el_values.append(el)
lower_values.append(lower)
def getSize():
max_degree = 0
max_kshell = 0
for degree in degrees:
if max_degree < int(degree):
max_degree = int(degree)
for kshell in kshells:
if max_kshell < kshell:
max_kshell = kshell
return max_degree max_kshell
def generateZ(max_degree max_kshell):
max_degree = int(max_degree)
max_kshell = int(max_kshell)
z_upper_values = [None] * max_kshell
z_eu_values = [None] * max_kshell
z_el_values = [None] * max_kshell
z_lower_values = [None] * max_kshell
for i in range(len(z_upper_values)):
z_upper_values[i] = [0] * max_degree
z_eu_values[i] = [0] * max_degree
z_el_values[i] = [0] * max_degree
z_lower_values[i] = [0] * max_degree
for j in range(len(degrees)):
index_x = degrees[j] # get the degree named index_x then regard the index_x-1 as the zvalue[][]‘s second dimention index. zvalue[][index-x-1]
index_y = kshells[j] # get the kshell named index_y then regard the max-kshell-index_y as the zvalue[][]‘s first dimention index. zvalue[max_kshell][]
upperValue = upper_values[j]
z_upper_values[int(max_kshell) - int(index_y)][int(index_x) - 1] = float(upperValue)
euValue = eu_values[j]
z_eu_values[int(max_kshell) - int(index_y)][int(index_x) - 1] = float(euValue)
elValue = el_values[j]
z_el_values[int(max_kshell) - int(index_y)][int(index_x) - 1] = float(elValue)
lowerValue = lower_values[j]
z_lower_values[int(max_kshell) - int(index_y)][int(index_x) - 1] = float(lowerValue)
return z_upper_values z_eu_values z_el_values z_lower_values
def draw_heatmap(data0 xlabels ylabels savepath titleStr):
cmap = cm.Blues
figure = plt.figure(facecolor=‘w‘)
# set the font
font = {‘family‘ : ‘serif‘ ‘color‘ : ‘darkred‘ ‘weight‘ : ‘normal‘ ‘size‘ : 16 }
titlefont = {‘
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5107 2017-05-12 12:27 python环境、代码及数据代码DrawHeatMap.py
文件 7416 2017-05-10 18:38 python环境、代码及数据其他不相关output1.csv
文件 1381985 2017-05-10 18:41 python环境、代码及数据其他不相关
esult_merged.csv
文件 8221 2017-05-04 19:46 python环境、代码及数据其他不相关代码CalCorrelation1_9_S.py
文件 2639 2017-05-11 17:33 python环境、代码及数据其他不相关代码Cal_DKBCEP.py
文件 1781978 2017-04-27 16:47 python环境、代码及数据其他不相关代码python_igraph-0.7.1.post6-cp27-none-win_amd64.whl
文件 407 2017-05-12 14:48 python环境、代码及数据其他不相关说明.txt
文件 2973 2017-05-10 18:41 python环境、代码及数据数据文件
esult_f_distribution.csv
文件 0 2017-05-12 14:41 python环境、代码及数据新建文本文档.txt
文件 6140635 2017-01-15 10:17 python环境、代码及数据环境matplotlib-1.5.3-cp27-cp27m-win_amd64.whl
文件 32997908 2017-01-15 09:35 python环境、代码及数据环境
umpy-1.11.3+mkl-cp27-cp27m-win_amd64.whl
文件 19382272 2017-01-14 21:53 python环境、代码及数据环境python-2.7.10.amd64.msi
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关代码
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关包
目录 0 2017-05-12 14:29 python环境、代码及数据代码
目录 0 2017-05-12 14:32 python环境、代码及数据其他不相关
目录 0 2017-05-12 14:29 python环境、代码及数据数据文件
目录 0 2017-05-12 14:49 python环境、代码及数据环境
目录 0 2017-05-12 14:41 python环境、代码及数据
----------- --------- ---------- ----- ----
61711541 19
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)