【发布时间】:2021-06-01 12:23:51
【问题描述】:
我需要划分这些点。
[ 1] H = G.copy() # networkx graph
[ 2] broken_parts = np.zeros((r*c)) # r,c=10 in this case
[ 3]
[ 4] v = np.where(data[:,0]<0)[0]
[ 5] broken_parts[v] += 1 # this successfully sets each entry in those specified locations to 1
[ 6]
[ 7] H.remove_nodes_from(v) # removes the previously selected nodes
[ 8] H = nx.convert_node_labels_to_integers(H)
[ 9]
[10] L, data1 = G_to_Coordinates(H,norm=True) # revises the data excluding the previously selected values
[11]
[12] v = np.where(data1[:,0]<0)[0] # finds the next partition
[13] broken_parts[broken_parts==0][v] += 2 # fails here, but intended to set the partition in broken_parts as 2
第 [12] 行成功找到数组位置,但 broken_parts 不随 2s 更新。我能做些什么来解决这个问题?
【问题讨论】: