Skip to content

Commit

Permalink
Fix the get_neighbors function
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliot Fosong committed Mar 25, 2016
1 parent 7db11f8 commit 44a5d56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ def get_neighbors(self, v):
'''Returns a list of all vertices w such that there is an edge
v -> w'''
try:
return list(zip(*adjacency_list[v]))[0]
return list(list(zip(*self.adjacency_list[v]))[0])
except KeyError:
print("Invalid vertex index")
print("Vertex " + str(v) + " does not exist")
except IndexError:
return []



Expand Down

0 comments on commit 44a5d56

Please sign in to comment.