def plotshortestpath(self, pltax, id=0):
"""
plot the shortest path
:param id:
:return:
"""
for i,path in enumerate(self.directshortestpaths):
if i is id:
pathedges = []
pathlength = len(path)
for pnidx in range(pathlength-1):
nid0 = path[pnidx]
nid1 = path[pnidx+1]
pathedges.append([self.composedgnodesplotpos[nid0][:2], self.composedgnodesplotpos[nid1][:2]])
pathedgesec = mc.LineCollection(pathedges, colors=[0, 1, 0, 1], linewidths=5)
pltax.add_collection(pathedgesec)
评论列表
文章目录