def decay_pt(self, pt):
"""
统计单点的距离衰减序列,没有考虑范围约束
:param pt:pt点ID
:return: 距离衰减序列
"""
dcy = [] # 保存每一阶邻域的vNI指数
neis = []
cur = [_ for _ in self.vertex.loc[pt, 'Neighbors']]
count = 0
while (cur):
if count >= MAX_NEI:
break
neis.extend([_ for _ in cur])
dcy.append(self.vNI(neis))
pre = [i for i in cur]
# 获取下一阶邻域
cur.clear()
for it in pre:
tmp = self.vertex.loc[it, 'Neighbors']
if tmp is not None:
cur.extend([k for k in tmp if k not in neis and k != pt and k not in cur])
if not cur: # 没有有效的邻居
break
count += 1
return dcy
网友评论