问题
I have 684 nodes and its corresponding temperature data.I calculated the correlation between all nodes and then reshape correlation list in adjacency matrix for further calculation. But after introducing lag in correlation I am not able to reshape the list in adjacency matrix.
I am able to reshape the list to adjacency matrix without lag but having problem when introducing the lag.
I tried
corr_k= []
for k in range(4):
for i in range(len(lat)):
for j in range(len(lon)):
for m in range(len(lat)):
for n in range(len(lon)):
corr_k.append( np.corrcoef ( air5[(365-k):(730-k),i,j] ,air5[365:730, m,n]))
df = pd.Dataframe(corr_k)
A = np.reshape(corr_k, (684, 684))
Now the problem is when i am introducing lag say 4, I got the list as (684*684*4) [684 total no. of nodes]. So now for each lag how to form adjacency matrix from the list?
来源:https://stackoverflow.com/questions/57972598/how-to-convert-any-arbitrary-list-to-an-adjaceny-matrix-in-python