1👍
✅
That’s because your using .get
. Since you’ve already retrieved the userEdges
and have them in memory, you can do:
while ... :
currentEdge = next(e for e in userEdges if e.nodeTo == node)
path.append(currentEdge.nodeFrom)
Source:stackexchange.com