Suppose i have a function like this:
def getNeighbors(vertex)
which returns a list of vertices that are neighbors of the given vertex. Now i want to create a list with all the neighbors of the neighbors. I do that like this:
listOfNeighborsNeighbors = []
for neighborVertex in getNeighbors(vertex):
listOfNeighborsNeighbors.append(getNeighbors(neighborsVertex))
Is there a more pythonic way to do that?